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
Seeing that the duration of a month varies greatly depending on which month in which year, marshaling time.Duration into ISO8601 with a month component would be ambiguous. As far as I know there is no context contained within the time.Duration type, as it is saved as a duration in nano seconds (int64). Therefore time.Duration should be marshaled into ISO8601 without year and month components.
I understand that the ISO definition states that even the number of minutes within a hour can vary, I believe in practice most parsers assume a 60min hour, however parsers, at least those I require, do not assume a fixed duration in ns for the Month component - resulting in errors when unmarshaling time.Duration.
Proposal:
Seeing that the duration of a month varies greatly depending on which month in which year, marshaling time.Duration into ISO8601 with a month component would be ambiguous. As far as I know there is no context contained within the time.Duration type, as it is saved as a duration in nano seconds (int64). Therefore time.Duration should be marshaled into ISO8601 without year and month components.
According to ISO8601 3.1.1.8
"...The exact duration of a time scale unit (3.1.1.7) depends on the time scale (3.1.1.5) used. For example, the durations of a year, month, week, day, hour or minute, may depend on when they occur [in a Gregorian calendar (3.1.1.19), a calendar month (3.1.2.19) can have a duration of 28, 29, 30, or 31 days; in a 24-hour clock (3.1.1.10), a clock minute (3.1.2.4) can have a duration of 59, 60, or 61 seconds, etc.]. Therefore, the exact duration can only be evaluated if the exact duration of each is known.
Note 4 to entry: This definition is closely related to NOTE 1 of the terminological entry “ duration ” in IEC 60050-113:2011, 113-01-13."
I understand that the ISO definition states that even the number of minutes within a hour can vary, I believe in practice most parsers assume a 60min hour, however parsers, at least those I require, do not assume a fixed duration in ns for the Month component - resulting in errors when unmarshaling time.Duration.
The imported library:
gqlgen/graphql/duration.go
Line 7 in 7b1908e
which is used here:
gqlgen/graphql/duration.go
Line 26 in 7b1908e
sets a fixed month component duration here:
https://github.com/sosodev/duration/blob/b7258bf670d35309ff417d0ab25fc77f9d338cfa/duration.go#L40
The text was updated successfully, but these errors were encountered: