The time objects sometimes obtained by antd are { "$L": "en", "$d": "2023-09-01T10:06:48.590Z", "$x": {}, "$y": 2023 , "$M": 8, "$D": 1, "$W": 5, "$H": 18, "$m": 6, "$s": 48, "$ms": 590 } A timestamp object like this,
//包含时间信息的 JSON 对象
const timeObject = {
"$L": "en",
"$d": "2023-09-01T10:06:48.590Z",
"$x": {},
"$y": 2023,
"$M": 8,
"$D": 1,
"$W": 5,
"$H": 18,
"$m": 6,
"$s": 48,
"$ms": 590
};
// 使用 dayjs 解析时间字符串并格式化为 'YYYY-MM-DD' 格式
const formattedDate = dayjs(timeObject["$d"]).format('YYYY-MM-DD');
console.log(formattedDate); // 输出:'2023-09-01'
In this way, the timestamp object can be converted into a readable format "YYYY-MM-DD"