2021-03-12 14:57:02 +00:00
|
|
|
export function formatDate(date) {
|
|
|
|
const day = getPeriodValue(date, { day: "2-digit" });
|
|
|
|
const month = getPeriodValue(date, { month: "2-digit" });
|
|
|
|
const year = getPeriodValue(date, { year: "numeric" });
|
|
|
|
|
|
|
|
return new Array(year, month, day).join("-");
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPeriodValue(date, option) {
|
|
|
|
const formatter = new Intl.DateTimeFormat("en-us", option);
|
|
|
|
return formatter.format(date);
|
|
|
|
}
|
2021-11-26 10:42:59 +00:00
|
|
|
|
|
|
|
export function formatTime(date) {
|
2022-01-31 08:37:49 +00:00
|
|
|
const formatter = new Intl.DateTimeFormat(["pl-Pl"], {
|
2021-11-26 10:42:59 +00:00
|
|
|
hour: "numeric",
|
|
|
|
minute: "numeric"
|
|
|
|
});
|
|
|
|
return formatter.format(date);
|
|
|
|
}
|