访问特定于语言环境的功能
你可以通过 dayjs.localeData()
函数或当前 Day.js 对象的 dayjs().localeData()
访问当前加载的语言环境的属性。
¥You can access the properties of the currently loaded locale through the dayjs.localeData()
function, or dayjs().localeData()
for current Day.js object.
This requires the
LocaleData
plugin to work
dayjs.extend(localeData)
globalLocaleData = dayjs.localeData()
globalLocaleData.firstDayOfWeek()
globalLocaleData.months()
globalLocaleData.monthsShort()
globalLocaleData.weekdays()
globalLocaleData.weekdaysShort()
globalLocaleData.weekdaysMin()
globalLocaleData.months(dayjs())
globalLocaleData.monthsShort(dayjs())
globalLocaleData.weekdays(dayjs())
globalLocaleData.weekdaysShort(dayjs())
globalLocaleData.weekdaysMin(dayjs())
instanceLocaleData = dayjs().localeData()
instanceLocaleData.firstDayOfWeek()
instanceLocaleData.months()
instanceLocaleData.monthsShort()
instanceLocaleData.weekdays()
instanceLocaleData.weekdaysShort()
instanceLocaleData.weekdaysMin()