mirror of
https://github.com/morris/vanilla-todo.git
synced 2025-08-11 08:33:58 +02:00
fix timezone issue
This commit is contained in:
@@ -33,7 +33,7 @@ export function TodoDay(el) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
const date = new Date(dateId);
|
const date = new Date(`${dateId}T00:00:00`);
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
today.setHours(0, 0, 0, 0);
|
today.setHours(0, 0, 0, 0);
|
||||||
const tomorrow = new Date(today);
|
const tomorrow = new Date(today);
|
||||||
@@ -41,6 +41,7 @@ export function TodoDay(el) {
|
|||||||
|
|
||||||
el.classList.toggle('-past', date < today);
|
el.classList.toggle('-past', date < today);
|
||||||
el.classList.toggle('-today', date >= today && date < tomorrow);
|
el.classList.toggle('-today', date >= today && date < tomorrow);
|
||||||
|
el.classList.toggle('-future', date >= tomorrow);
|
||||||
|
|
||||||
el.querySelector('.header > .dayofweek').innerText = formatDayOfWeek(date);
|
el.querySelector('.header > .dayofweek').innerText = formatDayOfWeek(date);
|
||||||
el.querySelector('.header > .date').innerText = formatDate(date);
|
el.querySelector('.header > .date').innerText = formatDate(date);
|
||||||
|
@@ -46,7 +46,7 @@ export class TodoLogic {
|
|||||||
const listsByDay = [];
|
const listsByDay = [];
|
||||||
|
|
||||||
for (let i = 0; i < 2 * range; ++i) {
|
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);
|
t.setDate(t.getDate() - range + i);
|
||||||
const id = formatDateId(t);
|
const id = formatDateId(t);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user