-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duration literals #34267
Comments
ISO 8601 uses things like "month" and "day" which aren't fixed duration. There's no clear way to translate such a thing into a machine value, e.g. float64 seconds. |
Can you give an example of how this would be used? I'm not clear on whether you are asking for a change to the language, or a change to an existing standard library package, or a new standard library package. |
And, of course, the Go standard library already has type const shortMonth = 30 * 24 * time.Hour
const longMonth = 31 * 24 * time.Hour
const februaryStandard = 28 * 24 * time.Hour
const februaryLeap = 29 * 24 * time.Hour |
See also #20757. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
Proposal: Duration literals for Go values and associated JSON, YAML representations, in order to reduce the likelihood of mistakes in application configurations.
No more forgetting, wondering about days vs nanoseconds vs seconds vs hours months vs business quarters vs milliseconds. No more gaps and misleading statements in documentation.
No more conversion errors. Just human readable durations, direct to well-defined machine values.
ISO 8601 format for duration literals would be a good place to start.
https://www.digi.com/resources/documentation/digidocs/90001437-13/reference/r_iso_8601_duration_format.htm
The text was updated successfully, but these errors were encountered: