more scheduler work
This commit is contained in:
parent
5081ff28bc
commit
869d1d9359
25
layout.html
25
layout.html
@ -601,9 +601,28 @@
|
|||||||
init_schedules();
|
init_schedules();
|
||||||
});
|
});
|
||||||
|
|
||||||
const init_schedules = () => {
|
const init_schedules = (first_day_of_week) => {
|
||||||
const today = new Date(Date.now()).getDay();
|
if (first_day_of_week === undefined) {
|
||||||
console.log(today);
|
const today = new Date(Date.now()).getDay();
|
||||||
|
let first_day_of_schedule = new Date(Date.now());
|
||||||
|
|
||||||
|
if (today < 1) {
|
||||||
|
// today is Sunday, the week started six days ago
|
||||||
|
first_day_of_schedule.setDate(first_day_of_schedule.getDate() - 6);
|
||||||
|
} else if (today > 1) {
|
||||||
|
// monday already passed, go back
|
||||||
|
offset = today - 1;
|
||||||
|
first_day_of_schedule.setDate(first_day_of_schedule.getDate() - offset);
|
||||||
|
} else {
|
||||||
|
// today is monday, the week has begun!
|
||||||
|
}
|
||||||
|
|
||||||
|
current_day = first_day_of_schedule;
|
||||||
|
for (let i = 0; i < 7; i++) {
|
||||||
|
console.log(current_day.toISOString());
|
||||||
|
current_day.setDate(current_day.getDate() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tag_editor_handlers = () => {
|
const tag_editor_handlers = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user