@mariefay/dst
v1.0.2
Published
Provides functions to deal with Daylight Saving Times
Downloads
14
Readme
Install
npm i @mariefay/dst
import { getDSTSundays } from "@mariefay/dst"
Usage
getDSTSundays
Daylight savings time starts on the last sunday of March and ends on the last sunday of October.
getDSTSundays returns the dates of those sundays.
The function takes an optional number parameter which represents the year that you would like the DST start and end dates for. If no date is passed in, it will take the current year. The function returns an array containing 2 elements : date of the first and last sundays of the daylight savings time, as strings
import { getDSTSundays } from "@mariefay/dst"
getDSTSundays(2020) // ["2020-03-29", "2020-10-25"]
isITDST
isItDST takes a date as an optional parameter and outputs a boolean that states weather the date provided is within the daylight savings time.
The date is optional and can be passed a a string or a Date object.
import { isItDST } from "@mariefay/dst"
isItDST("2020-09-24T17:25:08+00:00") // true
Run tests
npm t
🤝 Contributing
Contributions, issues and feature requests are welcome!
Show your support
Give a ⭐️ if this project helped you!