1.0.1 • Published 3 years ago

@share-code/calendar-fns v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

npm.io npm.io npm.io npm.io npm.io

calendar-fns

functions for calendar

Install

npm install @share-code/calendar-fns

Functions

isLeapYear

Check leap year

isLeapYear = (year: number) => boolean

getAnchorDay

Get anchor day, There are only four case

getAnchorDay = (year: number) => 2 | 0 | 5 | 3

getDoomsDayAlgorithm

Get the dooms day value using dooms day algorithm

getDoomsDayAlgorithm = (year: number) => number

getDoomsDay

Get Dooms day of specific month

getDoomsDay = (month: number, year: number) => { day: number, daysOfTheWeek: number }

getDayOfWeek

Get day of the week

0: Sunday

1: Monday

2: Tuesday

3: Wednesday

4: Thursday

5: Friday

6: Saturday

getDayOfWeek = (day: number, month: number, year: number) =>
  0 | 1 | 2 | 3 | 4 | 5 | 6

getDaysLengthOfMonth

Get length of the month

Possible case : 28, 29, 30, 31

getDaysLengthOfMonth = (month: number, year: number) => 28 | 29 | 30 | 31

License

MIT