🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

spacetime-holiday

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spacetime-holiday

reckoning of common holiday dates

0.3.0
latest
Source
npm
Version published
Weekly downloads
7.6K
3.88%
Maintainers
1
Weekly downloads
 
Created
Source

spacetime-holiday

calculate the calendar-date of holidays

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

MIT

FAQs

Package last updated on 18 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts