spacetime-holiday
v0.3.0
Published
reckoning of common holiday dates
Downloads
28,596
Readme
Some holidays are the same day every year, some holidays change astronomically, some by calendar rules like 'third thursday in June'.
This library tries its best to reconcile them.
if it finds a date, it returns a spacetime object.
to conserve filesize of your build, spacetime is a peerDependency, so must be installed separately:
npm i spacetime
npm i spacetime-holiday
const spacetimeHoliday = require('spacetime-holiday')
let s = spacetimeHoliday('easter monday', 2020)
s.format('iso-short')
// 2020-04-12
spacetimeHoliday('groundhog day').format('day') // defaults to next instance
// 'Saturday'
spacetimeHoliday('fall equinox', 2030).format('nice-year')
// 'Sept 22nd, 2030'
// add a timezone
let s = spacetimeHoliday('ramadan', 2019, 'Canada/Pacific')
s.iso()
// 2019-05-05T00:00:00.000-07:00
work-in-progress!
american/western holidays 👍
Easter-based christian holidays 👍
Astronomical holidays 👍
Muslim holidays (predicted) 😞
Jewish-calendar holidays (not implemented) 😞
Chinese-calendar holidays (not implemented) 😞
See also
- spacetime-daylight
- spacetime-week
- spacetime-informal - timezones like 'pacific time'
MIT