From 856c8a26e497b33cd63b55d3936f7c9a72e19e0c Mon Sep 17 00:00:00 2001 From: ThatOneCalculator Date: Mon, 12 Jun 2023 01:39:52 -0700 Subject: [PATCH] fix: :bug: properly enter date --- packages/client/src/components/MkDialog.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/MkDialog.vue b/packages/client/src/components/MkDialog.vue index 3c7c491fc9..0b2a26ad99 100644 --- a/packages/client/src/components/MkDialog.vue +++ b/packages/client/src/components/MkDialog.vue @@ -286,6 +286,13 @@ function onInputKeydown(evt: KeyboardEvent) { } } +function formatDateToYYYYMMDD(date) { + const year = date.getFullYear(); + const month = ("0" + (date.getMonth() + 1)).slice(-2); + const day = ("0" + date.getDate()).slice(-2); + return `${year}${month}${day}`; +} + async function openSearchFilters(ev) { await os.popupMenu( [ @@ -343,7 +350,7 @@ async function openSearchFilters(ev) { title: i18n.ts._filters.notesBefore, }).then((res) => { if (res.canceled) return; - inputValue.value += " before:" + res.result; + inputValue.value += " before:" + formatDateToYYYYMMDD(res.result); }); }, }, @@ -355,7 +362,7 @@ async function openSearchFilters(ev) { title: i18n.ts._filters.notesAfter, }).then((res) => { if (res.canceled) return; - inputValue.value += " after:" + res.result; + inputValue.value += " after:" + formatDateToYYYYMMDD(res.result); }); }, },