PHP 8.2.30
Preview: unicodeTokens.md Size: 1.62 KB
/home/byroehnu/easepay.easetack.com/node_modules/date-fns/docs/unicodeTokens.md

# Unicode Tokens

Starting with v2, `format` and `parse` use [Unicode tokens].

The tokens are different from Moment.js and other libraries that opted to use
custom formatting rules. While usage of a standard ensures compatibility and
the future of the library, it causes confusion that this document intends
to resolve.

## Popular mistakes

There are 4 tokens that cause most of the confusion:

- `D` and `DD` that represent the day of a year (1, 2, ..., 365, 366)
  are often confused with `d` and `dd` that represent the day of a month
  (1, 2, ..., 31).

- `YY` and `YYYY` that represent the local week-numbering year (44, 01, 00, 17)
  are often confused with `yy` and `yyyy` that represent the calendar year.

```js
// ❌ Wrong!
format(new Date(), 'YYYY-MM-DD')
//=> 2018-10-283

// ✅ Correct
format(new Date(), 'yyyy-MM-dd')
//=> 2018-10-10

// ❌ Wrong!
parse('11.02.87', 'D.MM.YY', new Date()).toString()
//=> 'Sat Jan 11 1986 00:00:00 GMT+0200 (EET)'

// ✅ Correct
parse('11.02.87', 'd.MM.yy', new Date()).toString()
//=> 'Wed Feb 11 1987 00:00:00 GMT+0200 (EET)'
```

To help with the issue, `format` and `parse` functions won't accept
these tokens without `useAdditionalDayOfYearTokens` option for `D` and `DD` and
`useAdditionalWeekYearTokens` options for `YY` and `YYYY`:

```js
format(new Date(), 'D', { useAdditionalDayOfYearTokens: true })
//=> '283'

parse('365+1987', 'DD+YYYY', new Date(), {
  useAdditionalDayOfYearTokens: true,
  useAdditionalWeekYearTokens: true
}).toString()
//=> 'Wed Dec 31 1986 00:00:00 GMT+0200 (EET)'
```

[Unicode tokens]: https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table

Directory Contents

Dirs: 0 × Files: 20

Name Size Perms Modified Actions
60 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
127 B lr--r--r-- 2026-03-14 01:49:14
Edit Download
721 B lrw-r--r-- 2026-02-28 00:36:12
Edit Download
510 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
390 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
689 B lrw-r--r-- 2026-02-28 00:36:12
Edit Download
2.31 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
2.02 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
2.78 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
27.67 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
3.57 KB lrw-r--r-- 2026-02-28 00:32:44
Edit Download
528 B lrw-r--r-- 2026-02-28 00:34:46
Edit Download
4.40 KB lrw-r--r-- 2026-02-28 00:34:46
Edit Download
2.37 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
2.63 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
1016 B lrw-r--r-- 2026-02-28 00:36:14
Edit Download
2.74 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
1.62 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
4.13 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download
1.40 KB lrw-r--r-- 2026-02-28 00:36:14
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).