evanisnor / durationjs

A JavaScript library for parsing and manipulating ISO 8601 formatted duration strings.
MIT License
13 stars 6 forks source link

Cannot handle fractions of a second (and potentially other fractions) #13

Open TravisBumgarner opened 6 years ago

TravisBumgarner commented 6 years ago

If I get some free time I'll take a look at it myself.

should output 1h 2m with input PT3723.14159S:

    Error: Unexpected duration format. Refer to ISO 8601.
     at new Duration (node_modules/durationjs/js/duration.js:49:11)

Per Wikipedia (https://en.wikipedia.org/wiki/ISO_8601)

The smallest value used may also have a decimal fraction, as in “P0.5Y” to indicate half a year. This decimal fraction may be specified with either a comma or a full stop, as in “P0,5Y” or “P0.5Y”.

matthewturner commented 4 years ago

I'm part way through this PR #15 but haven't sorted out the karma tests yet