From 5b2d924b4754d0be65a01764905c5f9b999438ec Mon Sep 17 00:00:00 2001 From: maciejpedzich Date: Tue, 5 Jul 2022 09:25:02 +0200 Subject: [PATCH] Ensure proper date conversion to midnight UTC --- pages/playlists/[playlistId]/snapshots/index.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pages/playlists/[playlistId]/snapshots/index.vue b/pages/playlists/[playlistId]/snapshots/index.vue index a45aaff..b511635 100644 --- a/pages/playlists/[playlistId]/snapshots/index.vue +++ b/pages/playlists/[playlistId]/snapshots/index.vue @@ -24,18 +24,19 @@ const route = useRoute(); const playlistId = route.params.playlistId; const isPortableScreen = useMediaQuery('(max-width: 768px)'); + const calendarDisplayDate = ref(new Date()); const queryMonth = ref(calendarDisplayDate.value.getMonth()); const queryYear = ref(calendarDisplayDate.value.getFullYear()); +const hoursOffset = -(calendarDisplayDate.value.getTimezoneOffset() / 60); const sinceDateParam = computed(() => - new Date(queryYear.value, queryMonth.value, 1).toISOString().substring(0, 10) + new Date(queryYear.value, queryMonth.value, 1, hoursOffset).toISOString() ); const untilDateParam = computed(() => - new Date(queryYear.value, queryMonth.value + 1, 1) - .toISOString() - .substring(0, 10) + new Date(queryYear.value, queryMonth.value + 1, 1, hoursOffset).toISOString() ); + const queryString = computed(() => { const queryParamsObj = new URLSearchParams();