-
Notifications
You must be signed in to change notification settings - Fork 231
Open
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.
Description
The OpenAPI definition of the duration format follows RFC 3339. The Kubernetes definition is more relaxed, which is nice, but IsDuration allows text that produces unexpected values from ParseDuration and unmarshaling.
https://go.dev/play/p/kZhy7fepBAM
I expected 1.5 hours
to be 90 minutes, but this valid text is interpreted as 5 hours:
fmt.Println(time.ParseDuration("1.5h")) // 1h30m0s <nil>
fmt.Println(strfmt.ParseDuration("1.5 hours")) // 5h0m0s <nil>
I expected 1.5 days
to be 36 hours, but this valid text is interpreted as 120 hours:
fmt.Println(strfmt.ParseDuration("1.5 days")) // 120h0m0s <nil>
fmt.Println(1.5 * 24 * time.Hour) // 36h0m0s
Metadata
Metadata
Assignees
Labels
lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.Denotes an issue or PR has remained open with no activity and has become stale.