You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When decoding a cbor data item, tagged with either tag 0 or tag 1, into an empty interface type, unmarshal returns a value of type time.Time. I would like a new decoding option with which unmarshal returns a RFC3339 string. This is needed to ensure compatibility in a project which expects unmarshal to return only certain types (bool, float64, string, []interface{}, map[string]interface{}, or nil).
Describe the solution you'd like
A new decode Option TimeTagToAnyMode whose default mode TimeTagToGoTime returns a time.Time value (current behavior). TimeTagToRFC3339String returns a time string in RFC3339 format and TimeTagToRFC3339NanoString returns a time string with nano seconds in RFC3339 format.
Additional context
I'd be happy to contribute the changes needed for this feature.
The text was updated successfully, but these errors were encountered:
fxamacker
changed the title
feature: Add option to return RFC3339 string while decoding tag 0 & 1 into interface{}
feature: Add TimeTagToAny option to produce RFC3339 when decoding time into interface{}
May 26, 2024
Is your feature request related to a problem? Please describe.
When decoding a cbor data item, tagged with either tag 0 or tag 1, into an empty interface type, unmarshal returns a value of type time.Time. I would like a new decoding option with which unmarshal returns a RFC3339 string. This is needed to ensure compatibility in a project which expects unmarshal to return only certain types (bool, float64, string, []interface{}, map[string]interface{}, or nil).
Describe the solution you'd like
A new decode Option
TimeTagToAnyMode
whose default modeTimeTagToGoTime
returns a time.Time value (current behavior).TimeTagToRFC3339String
returns a time string in RFC3339 format andTimeTagToRFC3339NanoString
returns a time string with nano seconds in RFC3339 format.Additional context
I'd be happy to contribute the changes needed for this feature.
The text was updated successfully, but these errors were encountered: