Oprava lokalizace datumu
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Choices, LocationKey } from "../../types";
|
||||
|
||||
const DAY_OF_WEEK_FORMAT = new Intl.DateTimeFormat(undefined, {weekday: 'long'});
|
||||
|
||||
/** Vrátí datum v ISO formátu. */
|
||||
export function formatDate(date: Date, format?: string) {
|
||||
let day = String(date.getDate()).padStart(2, '0');
|
||||
@@ -15,7 +17,7 @@ export function getHumanDate(date: Date) {
|
||||
let currentDay = String(date.getDate()).padStart(2, '0');
|
||||
let currentMonth = String(date.getMonth() + 1).padStart(2, "0");
|
||||
let currentYear = date.getFullYear();
|
||||
let currentDayOfWeek = date.toLocaleDateString("CZ-cs", { weekday: 'long' });
|
||||
let currentDayOfWeek = DAY_OF_WEEK_FORMAT.format(date);
|
||||
return `${currentDay}.${currentMonth}.${currentYear} (${currentDayOfWeek})`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user