fix: Fix RecipeLastMade dialog date picker being off by a day (#6079)

This commit is contained in:
Patrick Lehner (he/him)
2025-09-02 00:44:30 +09:00
committed by GitHub
parent 0883ef05ab
commit 3361f9a7c3

View File

@@ -119,6 +119,7 @@
<script setup lang="ts">
import { whenever } from "@vueuse/core";
import { formatISO } from "date-fns";
import { useUserApi } from "~/composables/api";
import { alert } from "~/composables/use-toast";
import { useHouseholdSelf } from "~/composables/use-households";
@@ -148,7 +149,7 @@ const newTimelineEventImageName = ref<string>("");
const newTimelineEventImagePreviewUrl = ref<string>();
const newTimelineEventTimestamp = ref<Date>(new Date());
const newTimelineEventTimestampString = computed(() => {
return newTimelineEventTimestamp.value.toISOString().substring(0, 10);
return formatISO(newTimelineEventTimestamp.value, { representation: "date" });
});
const lastMade = ref(props.recipe.lastMade);
@@ -169,7 +170,7 @@ whenever(
() => madeThisDialog.value,
() => {
// Set timestamp to now
newTimelineEventTimestamp.value = new Date(Date.now() - new Date().getTimezoneOffset() * 60000);
newTimelineEventTimestamp.value = new Date();
},
);