diff --git a/src/components/date-selector.vue b/src/components/date-selector.vue index 5c3c784..46c0485 100644 --- a/src/components/date-selector.vue +++ b/src/components/date-selector.vue @@ -3,13 +3,24 @@ import { selectedDate, selectedDay } from "../store"; import { dayNames } from "../definitions"; import dayjs from "dayjs"; import ArrowIcon from "./icons/arrow-icon.vue"; + +function nextDay() { + var newDate = dayjs(selectedDate.value).add(1, "day"); + // Skip weekend + if (newDate.day() == 6) newDate = newDate.add(2, "day"); + selectedDate.value = newDate.toDate(); +} +function previousDay() { + var newDate = dayjs(selectedDate.value).subtract(1, "day"); + // Skip weekend + if (newDate.day() == 0) newDate = newDate.subtract(2, "day"); + selectedDate.value = newDate.toDate(); +}