This commit is contained in:
jxxghp
2023-07-12 17:28:43 +08:00
parent eb3297fffe
commit 6b3240f2ba

View File

@@ -90,3 +90,11 @@ export const formatSeconds = (seconds: number) => {
return formattedTime;
}
// YYYY-MM-DD 转化为Date
export const parseDate = (dateString: string): Date => {
if (!dateString) return new Date();
const [year, month, day] = dateString.split('-').map(Number);
return new Date(year, month - 1, day);
}