1.0.0 • Published 2 years ago

has-friday-the-thirteenth v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

has-friday-the-thirteenth

Tells you if a given month has a Friday the 13th.

Install

npm install has-friday-the-thirteenth

Usage

Import the package into your project:

const hasFridayTheThirteenth = require('has-friday-the-thirteenth');

The method #hasFridayTheThirteenth accepts a string, number or Date and returns a boolean.

Check using a date string. Any string able to be parsed by Date.parse() is valid:

const foo = hasFridayTheThirteenth('January 1, 2023 00:00:00');

// true
console.log(foo);

const bar = hasFridayTheThirtheenth('31 Oct 2022 00:12:30 GMT');

// false
console.log(bar);

Check using a native Date object:

const bool = hasFridayTheThirteenth(new Date(2022, 9, 31));

Check using a timestamp:

const bool = hasFridayTheThirteenth(Date.now());

License

MIT