Package Exports
- human-date
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (human-date) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
human-date
Making dates and times readable for humans. Forks and pull requests most welcomed.
Usage
npm install human-date --save.date(arg)
argcan be a date object or string that parses into a date object.
hdate.date('8-16-1987')
// August 16th, 1987
hdate.date(new Date('8-16-1987'))
// August 16th, 1987.time(arg)
argcan be an integer representing seconds or a date string / object.
Note: Positive numbers represent the future and negative the past.
hdate.time(4)
// 4 seconds from now
hdate.time(-4)
// 4 seconds ago
hdate.time("8-16-1987")
// 27 years 96 days 21 hours 47 minutes 2 seconds ago
hdate.time("8-16-2020")
// 5 years 277 days 1 hours 41 minutes 43 seconds from now
hdate.time(new Date("8-16-1987"))
// 27 years 96 days 21 hours 47 minutes 2 seconds ago.month(arg)
argcan be an integer representing the month or a date string / object.
Note: Month number does not start at 0. For instance 1 Represents January.
hdate.month(8)
// August
hdate.month("8-16-1987")
// August
hdate.month(new Date("8-16-1987"))
// AugustTodos
- Add various options.
- Support different locales.
- Proper testing framework.