Utilities for working with week dates according to ISO week date (ISO 8601) and Hijri week calendars (Hijri week date) using Temporal.
Features:
- Offer a new PlainWeekDate class to represent a week date
- Convert any gregorian date to and from an ISO week date
- Convert any Hijri date to and from a Hijri week date
- Convert between supported calendars (Gregorian, ISO week, Hijri, Hijri week)
- Support custom week start day for both ISO week date and Hijri week date
- Format dates in ISO week date representation and Hijri week date representation
- Parse dates in ISO week representation and Hijri week date representation
- Offer custom Temporal calendars for both ISO 8601 and Hijri week calendars enhancing Temporal objects with week date capabilities
Important
As discussed in tc39/proposal-temporal#2854, custom calendars support will be removed, and this library will be updated accordingly.
pnpm add week-dates
For detailed usage see the Documentation
To run the tests on this repo you need to first generate some test data that the Hijri Week Calendar tests require. To do this, run the following command:
pnpm run generate
The script will ask you to verify the data however if you want to verify the data manually you can alwayse run the following command:
pnpm run verify
At this point you can run the tests using the following command:
pnpm test
or run the tests with test coverage in your browser by the following command:
pnpm test:ui
This library is heavily inspired by the work done by MohsenAlyafei and Khawarizmus on the Hijri Week Calendar standard proposal and it's JavaScript implementation