Hi
i want to change moment.js to day.js in my library.
I wonder how to use localaleData in day.js.
In case of moment.js
moment.localeData(locale).monthsShort()
@y0c
We have an experimental plugin localeData from v1.8.10
import dayjs from 'dayjs'
import localeData from 'dayjs/plugin/localeData'
import 'dayjs/locale/ko'
dayjs.extend(localeData) // use plugin
dayjs.locale('ko') // use locale
dayjs().localeData().monthsShort(dayjs())
demo: https://runkit.com/embed/488qfv8m02rz
And if you only want to get the locale object, just import ko from 'dayjs/locale/ko', like this https://github.com/iamkun/dayjs/blob/dev/docs/en/I18n.md#customize
feedback is welcomed.
Great, Thanks ! :)
Isn't there a way to get the locale object from a dayjs date?
Also I find the syntax for dayjs().localeData().monthsShort(dayjs()) a bit confusing. Which one of the two dayjs() instances should be the localized ones? Why do i have to pass to dayjs() instances and not just dayjs().localeData()?
Thanks.
updates #645
weeksMin, weeksShort ?
@transtone do you mean weekdaysMin weekdaysShort ?
Most helpful comment
@y0c
update doc: https://day.js.org/docs/en/plugin/locale-data
We have an experimental plugin
localeDatafrom v1.8.10demo: https://runkit.com/embed/488qfv8m02rz
And if you only want to get the locale object, just
import ko from 'dayjs/locale/ko', like this https://github.com/iamkun/dayjs/blob/dev/docs/en/I18n.md#customizefeedback is welcomed.