✨ Implement day navigation gestures with Swiper.js
This commit is contained in:
20
src/util.js
20
src/util.js
@ -29,23 +29,3 @@ export function getSubstitutionColor(substitution) {
|
||||
return "background-color: var(--substitution-background-cancellation);";
|
||||
}
|
||||
}
|
||||
|
||||
export function nextDay() {
|
||||
var newDate = dayjs(selectedDate.value).add(1, "day");
|
||||
// Skip weekend
|
||||
if (newDate.day() == 6) newDate = newDate.add(2, "day");
|
||||
changeDate(newDate);
|
||||
}
|
||||
export function previousDay() {
|
||||
var newDate = dayjs(selectedDate.value).subtract(1, "day");
|
||||
// Skip weekend
|
||||
if (newDate.day() == 0) newDate = newDate.subtract(2, "day");
|
||||
changeDate(newDate);
|
||||
}
|
||||
export async function changeDate(newDate) {
|
||||
selectedDate.value = new Date(newDate.toDate().setUTCHours(0, 0, 0, 0));
|
||||
loading.value = true;
|
||||
await fetchSubstitutions();
|
||||
await fetchHistory();
|
||||
loading.value = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user