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:
parent
68bafa808c
commit
999a517404
@ -51,7 +51,7 @@ FROM ${NODE_VERSION}
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Europe/Prague \
|
||||
LANG=cs_CZ.UTF-8 \
|
||||
LC_ALL=cs_CZ.UTF-8 \
|
||||
NODE_ENV=production
|
||||
|
||||
WORKDIR /app
|
||||
|
@ -4,7 +4,7 @@ FROM ${NODE_VERSION}
|
||||
|
||||
RUN apk add --no-cache tzdata
|
||||
ENV TZ=Europe/Prague \
|
||||
LANG=cs_CZ.UTF-8 \
|
||||
LC_ALL=cs_CZ.UTF-8 \
|
||||
NODE_ENV=production
|
||||
|
||||
WORKDIR /app
|
||||
|
@ -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})`;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user