From 24d380d37e2f26420d5f58c62d65fa3064957a9e Mon Sep 17 00:00:00 2001 From: Crimekillz Date: Sat, 19 Oct 2024 19:31:03 +0200 Subject: [PATCH] Show current date filter value --- packages/client/src/os.ts | 14 +++++++++++++- packages/client/src/pages/timeline.vue | 1 + scripts/build-greet.js | 6 +++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 0da953ec0..7dbbda916 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -508,6 +508,18 @@ export function inputNumber(props: { }); } +function formatDate(date?) { + if (date === null || date === undefined) + return undefined; + + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const localDate = `${year}-${month}-${day}`; + return localDate; +} + + export function inputDate(props: { title?: string | null; text?: string | null; @@ -529,7 +541,7 @@ export function inputDate(props: { input: { type: "date", placeholder: props.placeholder, - default: props.default, + default: formatDate(props.default), }, }, { diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index 3659f2d15..0e88ad6d8 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -215,6 +215,7 @@ function saveSrc( async function timetravel(): Promise { const { canceled, result: date } = await os.inputDate({ title: i18n.ts.date, + default: untilDate != undefined ? new Date(untilDate) : new Date(), }); if (canceled || isNaN(date.getTime())) return; diff --git a/scripts/build-greet.js b/scripts/build-greet.js index f26b78b90..dd6899f0d 100644 --- a/scripts/build-greet.js +++ b/scripts/build-greet.js @@ -1,10 +1,10 @@ const chalk = require("chalk"); console.log(chalk.magenta(" ______ __ ____ ")); -console.log(chalk.magenta(" /_ __/________ ______/ /_ / __ \____ __________")); -console.log(chalk.magenta(" / / / ___/ __ `/ ___/ __ \/ /_/ / __ \/ ___/ ___/")); +console.log(chalk.magenta(" /_ __/________ ______/ /_ / __ \\____ __________")); +console.log(chalk.magenta(" / / / ___/ __ `/ ___/ __ \\/ /_/ / __ \\/ ___/ ___/")); console.log(chalk.magenta(" / / / / / /_/ (__ ) / / / ____/ /_/ (__ |__ ) ")); -console.log(chalk.magenta("/_/ /_/ \__,_/____/_/ /_/_/ \____/____/____/ ")); +console.log(chalk.magenta("/_/ /_/ \\__,_/____/_/ /_/_/ \\____/____/____/ ")); console.log(chalk.magenta(" ")); console.log(chalk.magenta("Currently building TrashPoss!"));