Přidání restaurace Zastávka u Michala

This commit is contained in:
Michal Hájek
2025-01-14 23:45:06 +01:00
parent 02de6691a8
commit 0fd1482810
6 changed files with 180 additions and 12 deletions

View File

@@ -1,11 +1,13 @@
import { Choices, LocationKey } from "../../types";
/** Vrátí datum v ISO formátu. */
export function formatDate(date: Date) {
let currentDay = String(date.getDate()).padStart(2, '0');
let currentMonth = String(date.getMonth() + 1).padStart(2, "0");
let currentYear = date.getFullYear();
return `${currentYear}-${currentMonth}-${currentDay}`;
export function formatDate(date: Date, format?: string) {
let day = String(date.getDate()).padStart(2, '0');
let month = String(date.getMonth() + 1).padStart(2, "0");
let year = String(date.getFullYear());
const f = (format === undefined) ? 'YYYY-MM-DD' : format;
return f.replace('DD', day).replace('MM', month).replace('YYYY', year);
}
/** Vrátí human-readable reprezentaci předaného data pro zobrazení. */