地區設定
你可以使用 locale
來取得或設定時段的區域設定。區域設定會影響時段的字串方法,例如 humanize()
。有關國際化的更多資訊,請參閱 i18n 區段。
這需要 RelativeTime
外掛才能運作
require('dayjs/locale/es')
dayjs.duration(1, "minutes").locale("en").humanize(); // a minute
dayjs.duration(1, "minutes").locale("es").humanize(); // un minuto