@zamanapp/week-dates
v1.0.3
Published
Utilities for working with week dates according ISO 8601 (ISO week date) and Hijri week calendars (Hijri week date) using Temporal.
Downloads
10
Maintainers
Readme
week-dates
Utilities for working with week dates according 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
Installation
pnpm add week-dates
Usage
For detailed usage see the Documentation
Tests
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
Credit
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