恐怕在最新版本中(
1.3.3
),这是不可能的,因为
docs
国家:
基本国际化。
Luxon的代码中没有国际化字符串;相反,它依赖于Intl API的主机实现。这包括非常方便的
toLocaleString
。大多数浏览器和最新版本的节点都支持此功能。
此外,使用Luxon,您总是将周一作为一周的第一天,如以下代码片段所示:
// Luxon
const DateTime = luxon.DateTime;
console.log( DateTime.local().setLocale('fr-CA').startOf('week').toISO() );
// Moment.js
console.log( moment().locale('fr-ca').startOf('week').format() );
<script src="https://moment.github.io/luxon/global/luxon.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment-with-locales.min.js"></script>
请注意,没有
'week'
中的参数
startOf
文档:
“设置”此日期时间为时间单位的开头。
参数:
Name Type Attribute Description
unit string The unit to go to the beginning of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'.