Socket
Socket
Sign inDemoInstall

spacetime-holiday

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

spacetime-holiday

reckoning of common holiday dates


Version published
Maintainers
1
Weekly downloads
2,295
decreased by-14.75%

Weekly downloads

Readme

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

Last updated on 18 Apr 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc