rc: fix output of Time values in options/get

Before this change these were output as `{}` after this change they
are output as time strings `"2022-03-26T17:48:19Z"` in standard
javascript format.
This commit is contained in:
Nick Craig-Wood
2023-05-03 15:46:26 +01:00
parent 0468375054
commit 31caa019fa
2 changed files with 25 additions and 0 deletions

View File

@ -81,6 +81,11 @@ func (t *Time) UnmarshalJSON(in []byte) error {
return t.Set(s)
}
// MarshalJSON marshals as a time.Time value
func (t Time) MarshalJSON() ([]byte, error) {
return json.Marshal(time.Time(t))
}
// Scan implements the fmt.Scanner interface
func (t *Time) Scan(s fmt.ScanState, ch rune) error {
token, err := s.Token(true, func(rune) bool { return true })