1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-07-31 11:20:31 +02:00

fix timezone issue

This commit is contained in:
Morris Brodersen
2023-12-04 21:51:18 +01:00
parent 44f1030773
commit faf05386c4
2 changed files with 3 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ export function TodoDay(el) {
});
function update() {
const date = new Date(dateId);
const date = new Date(`${dateId}T00:00:00`);
const today = new Date();
today.setHours(0, 0, 0, 0);
const tomorrow = new Date(today);
@@ -41,6 +41,7 @@ export function TodoDay(el) {
el.classList.toggle('-past', date < today);
el.classList.toggle('-today', date >= today && date < tomorrow);
el.classList.toggle('-future', date >= tomorrow);
el.querySelector('.header > .dayofweek').innerText = formatDayOfWeek(date);
el.querySelector('.header > .date').innerText = formatDate(date);

View File

@@ -46,7 +46,7 @@ export class TodoLogic {
const listsByDay = [];
for (let i = 0; i < 2 * range; ++i) {
const t = new Date(data.at);
const t = new Date(`${data.at}T00:00:00`);
t.setDate(t.getDate() - range + i);
const id = formatDateId(t);