diff --git a/components/snapshot/Calendar.vue b/components/snapshot/Calendar.vue index a282038..9cd08ac 100644 --- a/components/snapshot/Calendar.vue +++ b/components/snapshot/Calendar.vue @@ -17,17 +17,22 @@ const route = useRoute(); const playlistId = route.params.playlistId; const now = new Date(); -const minDate = new Date('2021-12-01'); -const queryMonth = ref(now.getMonth()); -const queryYear = ref(now.getFullYear()); -const displayDate = reactive({ month: queryMonth, year: queryYear }); +const queryMonth = useState(`queryMonth${playlistId}`, () => now.getMonth()); +const queryYear = useState(`queryYear${playlistId}`, () => now.getFullYear()); -const hoursOffset = -(now.getTimezoneOffset() / 60); +const displayDate = new Date(queryYear.value, queryMonth.value); +const minDate = new Date('2021-12-01'); + +const hoursOffset = -(displayDate.getTimezoneOffset() / 60); const sinceDateParam = computed(() => - new Date(queryYear.value, queryMonth.value, 1, hoursOffset).toISOString() + new Date(queryYear.value, queryMonth.value, 1, hoursOffset) + .toISOString() + .substring(0, 10) ); const untilDateParam = computed(() => - new Date(queryYear.value, queryMonth.value + 1, 1, hoursOffset).toISOString() + new Date(queryYear.value, queryMonth.value + 1, 1, hoursOffset) + .toISOString() + .substring(0, 10) ); const queryString = computed(() => { @@ -97,14 +102,16 @@ const isQueryMonth = (date: Date) => date.getMonth() === queryMonth.value; Something went wrong while fetching archive entries