@lukaswhite/durations-js
v0.1.0
Published
A small JS library for working with durations.
Downloads
2
Readme
Durations JS
A small JS library for working with durations.
Basic Usage
let duration = new Duration( { hours: 2, minutes: 30 } )
console.log( duration.toSeconds( ) )
console.log( duration.humanize( ) )
ISO 8601
You can create an instance from an ISO 8601 duration string:
let duration = Duration.fromISO8601('P1Y2M4DT20H44M12.67S')
You can also convert to ISO 8601:
let duration = new Duration( { days : 6, hours: 3 } )
console.log( duration.toISO801String( ) ) // P6DT3H