fix: 🐛 properly enter date

This commit is contained in:
ThatOneCalculator 2023-06-12 01:39:52 -07:00
parent 1d9ce9c288
commit 856c8a26e4
No known key found for this signature in database
GPG Key ID: 8703CACD01000000
1 changed files with 9 additions and 2 deletions

View File

@ -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) { async function openSearchFilters(ev) {
await os.popupMenu( await os.popupMenu(
[ [
@ -343,7 +350,7 @@ async function openSearchFilters(ev) {
title: i18n.ts._filters.notesBefore, title: i18n.ts._filters.notesBefore,
}).then((res) => { }).then((res) => {
if (res.canceled) return; 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, title: i18n.ts._filters.notesAfter,
}).then((res) => { }).then((res) => {
if (res.canceled) return; if (res.canceled) return;
inputValue.value += " after:" + res.result; inputValue.value += " after:" + formatDateToYYYYMMDD(res.result);
}); });
}, },
}, },