0
l
の書式設定の瞬間から「M/D/YYYY」の形式で返されます。 ロケールによっては、D/M
またはM/D
の形式で日付を取得する方法はありますか?ここにコードがあります。例えばモーメントはロケールでフォーマットされています
var locale = window.navigator.userLanguage || window.navigator.language;
moment.locale(locale);
var momentTime = moment(d);
console.log(momentTime.format('l'));
ロケールがFrench
ある場合、日付はD/M
形式で返されるべきであり、ロケールがenglish-us
ある場合、日付は自動的M/D
形式で返さなければなりません。
[ロケールとMoment.js有する特定の日付フォーマット]の可能な重複(https://stackoverflow.com/questions/27360102/locale-and-specific-date-format-with -moment-js) – SubjectDelta