Show current date filter value

This commit is contained in:
Crimekillz 2024-10-19 19:31:03 +02:00
parent 06ad3eeff1
commit 24d380d37e
3 changed files with 17 additions and 4 deletions

View File

@ -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),
},
},
{

View File

@ -215,6 +215,7 @@ function saveSrc(
async function timetravel(): Promise<void> {
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;

View File

@ -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!"));