Formatting duration options #3693
Unanswered
kossnocorp
asked this question in
Ideas
Replies: 1 comment 2 replies
-
Depending on how format duration is implemented (or improved), we could also add the ability to parse strings to return a For example, var result = parseDuration(durationString: "2 days 3 hours")
//=> { days: 2, hours: 3 } var result = parseDuration(durationString: "10y 2m", formatString: "y'y' M'm'")
//=> { years: 10, months: 2 } |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@ckcherry23 is working on a duration improvements proposal, and one of the ideas she had is to add the ability to format duration using format string. I.e.:
While I can't see clearly how it would work, given the duration has variable units, I think it's worth considering. One of the alternatives is to have a predefined set of formats like
short
,time
,distance
, etc.Please share your feedback here.
Beta Was this translation helpful? Give feedback.
All reactions