fix(datetime): incorrect datetime parsing
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -40,7 +40,8 @@ build/
|
|||||||
|
|
||||||
### Generated Files ###
|
### Generated Files ###
|
||||||
/videos
|
/videos
|
||||||
outputs/
|
/outputs
|
||||||
|
frontend/.flowbite-react
|
||||||
|
|
||||||
generated
|
generated
|
||||||
.mvn
|
.mvn
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ function formatTime(seconds: number): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function stringToDate(dateString: string): Date {
|
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");
|
if (isNaN(date.getTime())) throw new Error("Invalid date string");
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user