Always marshal timeduration as a string

This commit is contained in:
Mariano Cano 2019-07-25 18:41:46 -07:00
parent 3ff410c695
commit d7221e15ac

View file

@ -75,7 +75,7 @@ func (t TimeDuration) MarshalJSON() ([]byte, error) {
switch { switch {
case t.t.IsZero(): case t.t.IsZero():
if t.d == 0 { if t.d == 0 {
return []byte("null"), nil return []byte(`""`), nil
} }
return json.Marshal(t.d.String()) return json.Marshal(t.d.String())
default: default: