fix date format to utc

This commit is contained in:
Fabrice LAMANT
2026-02-04 15:59:29 +01:00
parent 57d8aa96e6
commit 06fe12bee4

View File

@ -32,6 +32,12 @@ export class Scraper {
private readonly nocs: NOC[] = [];
private readonly sports: Sport[] = [];
private dateToUtcString(dateString: string): string {
const date = new Date(dateString);
const utc = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
return new Date(utc).toISOString();
}
private async getJSONData(url: string, cacheKey: string): Promise<any> {
this.debug(`getJSONData: url=${url}`);
@ -85,8 +91,8 @@ export class Scraper {
this.events.push({
key,
sport: event.disciplineCode,
start: event.startDate,
end: event.endDate,
start: this.dateToUtcString(event.startDate),
end: this.dateToUtcString(event.endDate),
medal: event.medalFlag.toString(),
name: {},
location: {},