Juration.js ========
npm install jurationJuration.js
========
A simple natural language duration parser written in javascript. Time ranges (in seconds) can also be converted to human readable strings. Check out the demo.
Inspired by chronic, and chronic_duration.
Fork changes
-----
- Added node.js package
- Multilanguage support
TODO
-----
- Make juration a function (so that settings aren't shared among instances)
Usage
-----
Client-side:
Node.js:
var juration = require('juration');
juration.parse("3mins 5secs"); // returns 185
Client-side:
Node.js
juration.setLanguage('it-IT');
Examples
--------
Parse-able strings:
* 12.4 secs
* 3 mins 4 sec
* 2 hrs 20 min
* 2h20min
* 6 mos 1 day
* 47 yrs 6 mos and 4d
* 3 weeks and 2 days
Todo
----
* Add customisable default unit option, e.g. juration.parse("10", { defaultUnit: 'minutes' }) // returns 600
* Parse chrono format i.e. hh:mm:ss
Licence
-------
Juration is copyright © 2011 Dom Christie and released under the MIT license.