Skip to content
generated from antfu/starter-ts

Utilities for working with week dates according to ISO week date (ISO 8601) Hijri week calendars Hijri week date using Temporal.

License

Notifications You must be signed in to change notification settings

zamanapp/week-dates

Repository files navigation

week-dates

npm version npm downloads bundle JSDocs License

Utilities for working with week dates according to ISO week date (ISO 8601) and Hijri week calendars (Hijri week date) using Temporal.

Documentation

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.

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

License

MIT License © 2023-PRESENT Zaman

About

Utilities for working with week dates according to ISO week date (ISO 8601) Hijri week calendars Hijri week date using Temporal.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published