Skip to content

Commit

Permalink
fix: more typescript cleaning and fixing, add more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhmoradi committed May 22, 2023
1 parent 87b022b commit 4b42986
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ With the `@calidy/dayjs-calendarsystems` plugin, we bring the capacity to run an
## Features

- Register and use different calendar systems.
- Typescript exports and definitions.
- Compatible with all official Dayjs plugins.
- No need for hacks, use dayjs apis in the standard way.
- Small and light plugin, no overhead.
- Convert between different calendar systems.
- Default Gregorian calendar system included.
- Persian Calendar system available.
- Other calendar systems are still under development.
- **[WIP]** Islamic (Hijri, Umalqura) Calendar system. Note: we will use the default "islamic-umalqura" calendar system for "islamic" calendar system.
- **[WIP]** Hebrew (Jewish) Calendar system.
- **[WIP]** Ethiopian Calendar system.
- **[TODO]** Parse date strings from different calendar systems
- **[TODO]** Add more tests for all Dayjs Plugins

Expand Down Expand Up @@ -60,6 +66,10 @@ import calendarSystems from "@calidy/dayjs-calendarsystems";

import PersianCalendarSystem from "@calidy/dayjs-calendarsystems/calendarSystems/PersianCalendarSystem";

// ...
// ALL YOU OTHER dayjs.extend() calls
// ...
// After all other dayjs plugins are initialized, extend dayjs with our calendar systems plugin:
dayjs.extend(calendarSystems);

// Register new calendar system
Expand Down
7 changes: 6 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { PluginFunc, Dayjs } from 'dayjs';
import { CalendarSystemBase } from './calendarSystems/CalendarSystemBase';
export type CalendarSystem = 'persian' | 'gregorian' | 'islamic' | 'julian' | 'indian' | 'hebrew' | 'ethiopian' | 'coptic' | 'buddhist' | 'japanese' | 'roc' | 'nanakshahi' | 'isoWeek' | 'week' | 'quarter' | 'month' | 'year' | 'decade' | 'century' | 'millennium';
// All Calendar Systems known to Intl API (alphabetical order)
// 'buddhist' | 'chinese' | 'coptic' | 'dangi' | 'ethioaa' | 'ethiopic' | 'gregory' | 'hebrew' | 'indian' | 'islamic' | 'islamic-civil' | 'islamic-rgsa' | 'islamic-tbla' | 'islamic-umalqura' | 'islamicc' | 'iso8601' | 'japanese' | 'persian' | 'roc'
// Our supported Calendar Systems (alphabetical order)
export type CalendarSystem = 'gregory' | 'persian';
// TODO: export type CalendarSystem = 'gregory' | 'persian' | 'islamic' | 'islamic-umalqura' | 'hebrew' | 'ethiopic';
// ! Note that we use the default "islamic-umalqura" calendar system for "islamic" calendar system

declare module 'dayjs' {
interface Dayjs {
Expand Down

0 comments on commit 4b42986

Please sign in to comment.