fix(datetime): incorrect datetime parsing

This commit is contained in:
2026-06-25 23:10:32 +01:00
parent 3d57007074
commit 7db25194bc
2 changed files with 4 additions and 2 deletions

View File

@@ -8,7 +8,8 @@ function formatTime(seconds: number): string {
}
function stringToDate(dateString: string): Date {
const date = new Date(dateString.substring(0, 23));
const normalized = dateString.replace(/(\.\d{3})\d+/, "$1");
const date = new Date(normalized);
if (isNaN(date.getTime())) throw new Error("Invalid date string");
return date;
}