Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gigobyte/iso8601-duration
Convert between ISO-8601 durations strings and Duration values https://package.elm-lang.org/packages/gigobyte/iso8601-duration/latest/
https://github.com/gigobyte/iso8601-duration
Last synced: 22 days ago
JSON representation
Convert between ISO-8601 durations strings and Duration values https://package.elm-lang.org/packages/gigobyte/iso8601-duration/latest/
- Host: GitHub
- URL: https://github.com/gigobyte/iso8601-duration
- Owner: gigobyte
- License: bsd-3-clause
- Created: 2020-02-06T20:30:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-27T18:12:10.000Z (over 4 years ago)
- Last Synced: 2024-10-16T07:09:19.877Z (2 months ago)
- Language: Elm
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# iso8601-duration
This library converts between ISO-8601 duration strings as described [here](https://en.wikipedia.org/wiki/ISO_8601#Durations) and an easy-to-use data structure.
Both the basic (`PnYnMnDTnHnMnS`) and week (`PnW`) formats are supported.
The extended format (`P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]`) is not supported.
## Install
```
elm install gigobyte/iso8601-duration
```## Example
```elm
import Iso8601.Duration as DurationDuration.fromString "P3Y6M4DT12H30M5S"
-- Just
-- { years = 3
-- , months = 6
-- , days = 4
-- , hours = 12
-- , minutes = 30
-- , seconds = 5
-- }Duration.fromString "P12W"
-- Just
-- { years = 0
-- , months = 0
-- , days = 84
-- , hours = 0
-- , minutes = 0
-- , seconds = 0
-- }
```