Human-readable interval parser for Javascript. Converts words written in English to numbers by using node-numbered.
This is a fork of @rschmukler project human-interval
npm install @lesjoursfr/human-intervalhumanInterval("three minutes");Human Interval understands all of the following examples:
humanInterval("minute");
humanInterval("one minute");
humanInterval("1.5 minutes");
humanInterval("3 days and 4 hours");
humanInterval("3 days, 4 hours and 36 seconds");
humanInterval("4 months, 3 days, 5 hours and forty-five seconds");Supports the following units in the plural and singular forms:
secondsminuteshoursdaysweeksmonths— assumes 30 daysyears— assumes 365 days
Supports numbers being written out in English words.
humanInterval("five minutes");Supports hyphenated numbers.
humanInterval("twenty-five seconds");Supports negative numbers if the time starts with a - symbol immediately followed by a number.
humanInterval("-2 minutes");Return the number of milliseconds from a str interval.
To run the tests, you'll need Node.js:
npm install
npm run test