dayjs

What are some examples of dayjs Localized Formats in action?


I don't understand how day.js Localized Formats works in action.

The day.js docs says this about Localized Formats:

Because preferred formatting differs based on locale, there are a few localized format tokens that can be used based on its locale.

But then the example table underneath that just shows English formatting which is identical to what can already be achieved using the standard formatting.

The docs don't make it clear how things change based on different locales.

Can someone show me using examples?


Solution

  • For anyone else looking, this file can used to see how things changed based on locale: https://github.com/iamkun/dayjs/tree/dev/src/locale

    For example, dayjs.format('L') returns October 27, 2023 in the default en locale, but 2023年10月27日 in the ja locale.