toLocaleDateString 返回字符串而不关心语言环境
toLocaleDateString returning String without caring of locale
我正在使用 Discord.js 在 NodeJS 中开发一个 Discord 机器人,我想解析 "YYYY-MM-DD" 格式的日期并以长 fr-FR 格式显示。
我试过了:
var dateSortie = new Date("2018-06-03");
var options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
};
console.log(dateSortie.toLocaleDateString("fr-FR", options));
无论语言环境如何(fr-Fr、de-De、...),它总是返回 "2018 M06 3, Sun"
。
采购自 this GitHub 问题:
By default --with-intl=small-icu
is used to build node, which
contains just the en-US locale [...]. You will need to either build
node with --with-intl=full-icu
or --with-intl=system-icu
if you
want to be able to use more locales. The reason node is built with a
smaller ICU by default is file size.
除了构建您自己的节点版本之外,另一种方法似乎是安装 full-icu
模块。
我正在使用 Discord.js 在 NodeJS 中开发一个 Discord 机器人,我想解析 "YYYY-MM-DD" 格式的日期并以长 fr-FR 格式显示。
我试过了:
var dateSortie = new Date("2018-06-03");
var options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
};
console.log(dateSortie.toLocaleDateString("fr-FR", options));
无论语言环境如何(fr-Fr、de-De、...),它总是返回 "2018 M06 3, Sun"
。
采购自 this GitHub 问题:
By default
--with-intl=small-icu
is used to build node, which contains just the en-US locale [...]. You will need to either build node with--with-intl=full-icu
or--with-intl=system-icu
if you want to be able to use more locales. The reason node is built with a smaller ICU by default is file size.
除了构建您自己的节点版本之外,另一种方法似乎是安装 full-icu
模块。