New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@date/generator

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@date/generator

Calculate dates with easy to read helper functions

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
decreased by-25.25%
Maintainers
2
Weekly downloads
 
Created
Source

@date/generator

Build Status Dependency Status npm version

Generate dates with readable function chaining.

Also has functions accepting numbers to help with using values provided from elsewhere.

Install

npm install @date/generator --save

Usage

var gen = require('@date/generator')

// these are equivalent:
//   specify each thing individually
var washingtonDay = gen.third().monday().in().january().of(2016)
//   skip the in() and of() and specify the year in the january() call
var washingtonDay = gen.third().monday().january(2016)
//   specify 'third' with a '3' to monday(),
//           january with '0' to month()
var washingtonDay = gen.monday(3).month(0).of(2016)

var thanksgiving  = gen.fourth().thursday().in().november().of(2016)

Order

Start with the order functions:

  1. first() - 1
  2. second() - 2
  3. third() - 3
  4. fourth() - 4
  5. last() - 5 (will be last, even when last is the fourth)

Days

Day functions are available after calling an order function, or, start with them and specify the order value as 1-5:

  1. sunday()
  2. monday()
  3. tuesday()
  4. wednesday()
  5. thursday()
  6. friday()
  7. saturday()

Months

Month functions are available after calling a day function:

  1. january()
  2. february()
  3. march()
  4. april()
  5. may()
  6. june()
  7. july()
  8. august()
  9. september()
  10. october()
  11. november()
  12. december()

Also, shortcut making a call to of(year) after it and specify the year in the month call, like august(2016).

Years

Last call specifies the year to function of(year) and returns a Date instance.

MIT License

Keywords

FAQs

Package last updated on 22 Jul 2016

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc