Skip to content

Commit

Permalink
v 4.5.0
Browse files Browse the repository at this point in the history
* Update calendars.md (#1541)
  • Loading branch information
tonysamperi committed Dec 9, 2023
1 parent e6d4d48 commit b8362c5
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions projects/app/src/docs/docs/calendars.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This covers TSLuxon's support for various calendar systems. If you don't need to
TSLuxon has full support for Gregorian and ISO Week calendars. What I mean by that is that TSLuxon can parse dates specified in those calendars, format dates into strings using those calendars, and transform dates using the units of those calendars. For example, here is TSLuxon working directly with an ISO calendar:

```js
DateTime.fromISO('2017-W23-3').plus({ weeks: 1, days: 2 }).toISOWeekDate(); //=> '2017-W24-5'
DateTime.fromISO('2017-W23-3').plus({ weeks: 1, days: 2 }).toISOWeekDate(); //=> "2017-W24-5"
```

The main reason I bring all this is up is to contrast it with the capabilities for other calendars described below.
Expand All @@ -22,8 +22,8 @@ The output calendar is a property of the DateTime itself. For example:

```js
var dtHebrew = DateTime.now().reconfigure({ outputCalendar: "hebrew" });
dtHebrew.outputCalendar; //=> 'hebrew'
dtHebrew.toLocaleString() //=> '4 Tishri 5778'
dtHebrew.outputCalendar; //=> "hebrew"
dtHebrew.toLocaleString() //=> "4 Tishri 5778"
```

You can modulate the structure of that string with arguments to `toLocaleString` (see [the docs on that](formatting.md?id=tolocalestring-strings-for-humans)), but the point here is just that you got the alternative calendar.
Expand All @@ -36,22 +36,25 @@ Here's a table of the different calendars with examples generated formatting the
DateTime.fromObject({ outputCalendar: c }).toLocaleString(DateTime.DATE_FULL);
```

| Calendar | Example |
| --- | --- |
| buddhist | September 24, 2560 BE |
| chinese | Eighth Month 5, 2017 |
| coptic | Tout 14, 1734 ERA1 |
| ethioaa | Meskerem 14, 7510 ERA0 |
| ethiopic | Meskerem 14, 2010 ERA1 |
| hebrew | 4 Tishri 5778 |
| indian | Asvina 2, 1939 Saka |
| islamic | Muharram 4, 1439 AH |
| islamicc | Muharram 3, 1439 AH |
| iso8601 | September 24, 2017 |
| japanese | September 24, 29 Heisei |
| persian | Mehr 2, 1396 AP |
| roc | September 24, 106 Minguo |

Since TSLuxon uses the browser's **Intl API**, you can use all the supported calendars.
(See [Intl.Locale.prototype.getCalendars()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getCalendars) for a full list)

| Calendar | Example |
| ------------------ | ------------------------ |
| buddhist | September 24, 2560 BE |
| chinese | Eighth Month 5, 2017 |
| coptic | Tout 14, 1734 ERA1 |
| ethioaa | Meskerem 14, 7510 ERA0 |
| ethiopic | Meskerem 14, 2010 ERA1 |
| hebrew | 4 Tishri 5778 |
| indian | Asvina 2, 1939 Saka |
| islamic | Muharram 4, 1439 AH |
| islamic-civil | Muharram 3, 1439 AH |
| islamic-umalqura | Muharram 3, 1439 AH |
| iso8601 | September 24, 2017 |
| japanese | September 24, 29 Heisei |
| persian | Mehr 2, 1396 AP |
| roc | September 24, 106 Minguo |

### Default output calendar

Expand Down

0 comments on commit b8362c5

Please sign in to comment.