在浏览器中加载语言环境
按需加载区域设置。
¥Loading locale on demand.
<script src="path/to/dayjs/locale/de"></script>
<script>
dayjs.locale('de') // use locale globally
dayjs().locale('de').format() // use locale in a specific instance
</script>
获取区域设置对象以供进一步使用。
¥Get the locale object for further use.
<script src="path/to/dayjs/locale/de"></script>
<!-- Load locale as window.dayjs_locale_NAME -->
<script>
var customLocale = window.dayjs_locale_zh_cn // zh-cn -> zh_cn
</script>
Day.js 于 CDN 可用。
¥Day.js is available on CDN.
<!-- CDN example (jsDelivr) -->
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/locale/zh-cn.js"></script>
<script>dayjs.locale('zh-cn')</script>