Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
36 lines
711 B
Plaintext
36 lines
711 B
Plaintext
const accusativeWeekdays = [
|
|
"vasárnap",
|
|
"hétfőn",
|
|
"kedden",
|
|
"szerdán",
|
|
"csütörtökön",
|
|
"pénteken",
|
|
"szombaton",
|
|
];
|
|
|
|
function week(isFuture) {
|
|
return (date) => {
|
|
const weekday = accusativeWeekdays[date.getDay()];
|
|
const prefix = isFuture ? "" : "'múlt' ";
|
|
return `${prefix}'${weekday}' p'-kor'`;
|
|
};
|
|
}
|
|
const formatRelativeLocale = {
|
|
lastWeek: week(false),
|
|
yesterday: "'tegnap' p'-kor'",
|
|
today: "'ma' p'-kor'",
|
|
tomorrow: "'holnap' p'-kor'",
|
|
nextWeek: week(true),
|
|
other: "P",
|
|
};
|
|
|
|
export const formatRelative = (token, date) => {
|
|
const format = formatRelativeLocale[token];
|
|
|
|
if (typeof format === "function") {
|
|
return format(date);
|
|
}
|
|
|
|
return format;
|
|
};
|