Commit ebad701
Simon Coffey
Add full ISO8601 duration decimal support
In previous commits I added millisecond support for the validUntil
duration field.
It turns out that the ISO8601 spec[1] also supports milliseconds for
some other duration components (S4.4.3.2):
> If necessary for a particular application, the lowest order
> components may have a decimal fraction.
Which components this affects is slightly ambiguous; I've interpreted it
to mean the hours, minutes and seconds components.
In part that's because our current implementation uses
DateTime#next_year, #next_month and #next_day to apply all other fields
to the computed duration, and these methods only respect integer step
inputs. They accept floats, but fractional parts are ignored.
This commit therefore adds fractional support to the H/M/S components,
and updates the computation to support a comma decimal separator.
[1] https://www.loc.gov/standards/datetime/iso-tc154-wg5_n0038_iso_wd_8601-1_2016-02-16.pdf1 parent cb98e39 commit ebad701
1 file changed
Lines changed: 10 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 62 | + | |
| 63 | + | |
69 | 64 | | |
70 | 65 | | |
71 | 66 | | |
| |||
0 commit comments