diff --git a/src/components/SingleDatePicker.vue b/src/components/SingleDatePicker.vue index 4fbcd76..97c0d29 100644 --- a/src/components/SingleDatePicker.vue +++ b/src/components/SingleDatePicker.vue @@ -4,17 +4,38 @@ const selectMonth = ref(false) const uniqueId = generateUniqueId() + const currentMonth = ref(new Date().getMonth()) + const currentYear = ref(new Date().getFullYear()) + + function goToLastMonth() { + if (currentMonth.value === 0) { + currentMonth.value = 11 + currentYear.value -= 1 + } else { + currentMonth.value -= 1 + } + } + + function goToNextMonth() { + if (currentMonth.value === 11) { + currentMonth.value = 0 + currentYear.value += 1 + } else { + currentMonth.value += 1 + } + } +