@gaborcsardi, I can imagine that not everyone would want fractional seconds unless they are coming in the seconds part of the time.
For example, if someone gives a fractional hour, I assume that they would want minutes and maybe seconds, but they probably don't want fractional seconds. And similarly, if someone gives a fractional minutes, they probably want seconds, but they probably don't want fractional seconds.
My first thought is to add a round_time argument to parse_iso_8601(). That argument would have six ways it could be provided:
TRUE (my suggested default): Round fractions to one time unit more precise than what is given:
If fractional hours are given, round the minutes, seconds are 0.
If fractional minutes are given, round the seconds, fractional seconds are 0.
If fractional seconds are given, round to the nearest millisecond
FALSE: No rounding, get full precision down to fractional seconds (even beyond milliseconds), if provided.
One of "hours", "mins", "secs", "msec" which would round to those levels.
Related to #43
@gaborcsardi, I can imagine that not everyone would want fractional seconds unless they are coming in the seconds part of the time.
For example, if someone gives a fractional hour, I assume that they would want minutes and maybe seconds, but they probably don't want fractional seconds. And similarly, if someone gives a fractional minutes, they probably want seconds, but they probably don't want fractional seconds.
My first thought is to add a
round_time
argument toparse_iso_8601()
. That argument would have six ways it could be provided:TRUE
(my suggested default): Round fractions to one time unit more precise than what is given:FALSE
: No rounding, get full precision down to fractional seconds (even beyond milliseconds), if provided.