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:
@@ -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);
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user