fix calendar bug

This commit is contained in:
Raphael D. Pinheiro
2024-07-04 21:30:23 +02:00
parent 76b41dc546
commit 5449805cc0

View File

@@ -34,7 +34,7 @@
let speed: number | undefined = undefined; let speed: number | undefined = undefined;
function toCalendarDate(date: Date): CalendarDate { function toCalendarDate(date: Date): CalendarDate {
return new CalendarDate(date.getFullYear(), date.getMonth(), date.getDate()); return new CalendarDate(date.getFullYear(), date.getMonth() + 1, date.getDate());
} }
const { velocityUnits, distanceUnits } = settings; const { velocityUnits, distanceUnits } = settings;
@@ -83,7 +83,7 @@
return new Date(); return new Date();
} }
let [hours, minutes, seconds] = time.split(':').map((x) => parseInt(x)); let [hours, minutes, seconds] = time.split(':').map((x) => parseInt(x));
return new Date(date.year, date.month, date.day, hours, minutes, seconds); return new Date(date.year, date.month - 1, date.day, hours, minutes, seconds);
} }
function updateEnd() { function updateEnd() {