Skip to content

Commit 2a9fec8

Browse files
committed
Cookbook example of custom calendar
Add a page showing how to do a custom calendar by creating a class that works like PlainDate, but implements a calendar that isn't built in to JavaScript.
1 parent 17a482c commit 2a9fec8

File tree

4 files changed

+485
-0
lines changed

4 files changed

+485
-0
lines changed

docs/cookbook-nepali-calendar.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Nepali calendar
2+
3+
Support for the Nepali calendar is currently not built in to JS
4+
environments.
5+
This example shows how to implement a custom calendar with Temporal, by
6+
creating a date class for that calendar that works like PlainDate and
7+
can be used as a PlainDate property bag.
8+
9+
```javascript
10+
{{cookbook/nepaliCalendar.mjs}}
11+
```

docs/cookbook.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,11 @@ Extend `Temporal` to support arbitrarily-large years (e.g., **+635427810-02-02**
567567
Extend `Temporal` to support adjustment days for the Hijri calendars, which are sometimes required when the start of the month is based on astronomical observations.
568568

569569
[Adjustable Hijri calendar](hijri-days-adjustments.md)
570+
571+
### Nepali calendar
572+
573+
Implementation of the Nepali calendar in userspace.
574+
This calendar is currently not built in to JS environments.
575+
This serves as an example of how to build support for calendars that are not widespread in browsers.
576+
577+
[Nepali calendar](cookbook-nepali-calendar.md)

docs/cookbook/all.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import './getUtcOffsetStringAtInstant.mjs';
2424
import './getWeeklyDaysInMonth.mjs';
2525
import './localTimeForFutureEvents.mjs';
2626
import './makeExpandedTemporal.mjs';
27+
import './nepaliCalendar.mjs';
2728
import './nextWeeklyOccurrence.mjs';
2829
import './noonOnDate.mjs';
2930
import './plusAndRoundToMonthStart.mjs';

0 commit comments

Comments
 (0)