Introduction
What Is It?
@zamanapp/week-dates
is a utility library for working with week dates according ISO 8601 (ISO week date) and Hijri week calendars (Hijri week date) using Temporal.
why This Library?
The following are some of the reasons why you might want to use @zamanapp/week-dates
library:
First class support for week dates: Currently there is no way for Temporal to represent week dates. which is a common use case for many applications. although this feature was requested before to be included in the initial Temporal Proposal, It was reconsidered but eventually it was decided to be out of scope for the initial Temporal proposal. and pushed to Temporal V2 instead.
@zamanapp/week-dates
library offer a newPlainWeekDate
class to represent a week date. This class has a familiar API to other Temporal classes (with minor inconsistencies) making it easy to pick up and use.Support ISO and Hijri week dates:
@zamanapp/week-dates
library offers a way to represent week dates in Temporal in compliance with ISO 8601 as well as Hijri week calendar which is useful for applications that need to work with Hijri dates and need to represent them in a week date format.Custom week start day: All operations and primitives in
@zamanapp/week-dates
support custom week start day for both ISO week date and Hijri week date. This is particularly useful for compliance with RFC5545 and RFC7529 or for any applications that need to work with week dates that start on different week days then the ones defined in the standards.Custom Temporal calendar: On top of offering
PlainWeekDate
class,@zamanapp/week-dates
offer custom Temporal calendars for both ISO 8601 and Hijri week calendars for easy integration with Temporal. All these calendars just extend already existing Temporal calendars and add support for week dates to already existing Temporal Objects that support calendars likeTemporal.PlainDate
,Temporal.PlainDateTime
andTemporal.ZonedDateTime
.
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