0

我正在使用 dayjs@1.10.4。

我收到一个法语格式的日期,例如“01/02/03”。它应该等于 2003 年 2 月 1 日。

我希望根据我在 dayjs 中设置的本地自动检测格式。

import * as localeData from 'dayjs/plugin/localeData';
import 'dayjs/locale/fr';
... 
dayjs.locale('fr');
dayjs('01/02/03').format('YYYY-MM-DD'); // Return '2003-01-02', I'm expecting '2003-02-01'

我不知道日期的确切格式是什么,所以我不能将它设置为 dayjs 的第二个参数。我只知道我会收到什么语言。

不确定它是如何工作的。

4

0 回答 0