timepiece/node_modules/date-fns/locale/cs/_lib/formatRelative.mjs

32 lines
591 B
JavaScript
Raw Normal View History

2024-05-14 14:54:12 +00:00
const accusativeWeekdays = [
"neděli",
"pondělí",
"úterý",
"středu",
"čtvrtek",
"pátek",
"sobotu",
];
const formatRelativeLocale = {
lastWeek: "'poslední' eeee 've' p",
yesterday: "'včera v' p",
today: "'dnes v' p",
tomorrow: "'zítra v' p",
nextWeek: (date) => {
const day = date.getDay();
return "'v " + accusativeWeekdays[day] + " o' p";
},
other: "P",
};
export const formatRelative = (token, date) => {
const format = formatRelativeLocale[token];
if (typeof format === "function") {
return format(date);
}
return format;
};