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
45 lines
1022 B
Plaintext
45 lines
1022 B
Plaintext
import { isSameWeek } from "../../../isSameWeek.js";
|
|
|
|
const weekdays = [
|
|
"svētdienā",
|
|
"pirmdienā",
|
|
"otrdienā",
|
|
"trešdienā",
|
|
"ceturtdienā",
|
|
"piektdienā",
|
|
"sestdienā",
|
|
];
|
|
|
|
const formatRelativeLocale = {
|
|
lastWeek: (date, baseDate, options) => {
|
|
if (isSameWeek(date, baseDate, options)) {
|
|
return "eeee 'plkst.' p";
|
|
}
|
|
|
|
const weekday = weekdays[date.getDay()];
|
|
return "'Pagājušā " + weekday + " plkst.' p";
|
|
},
|
|
yesterday: "'Vakar plkst.' p",
|
|
today: "'Šodien plkst.' p",
|
|
tomorrow: "'Rīt plkst.' p",
|
|
nextWeek: (date, baseDate, options) => {
|
|
if (isSameWeek(date, baseDate, options)) {
|
|
return "eeee 'plkst.' p";
|
|
}
|
|
|
|
const weekday = weekdays[date.getDay()];
|
|
return "'Nākamajā " + weekday + " plkst.' p";
|
|
},
|
|
other: "P",
|
|
};
|
|
|
|
export const formatRelative = (token, date, baseDate, options) => {
|
|
const format = formatRelativeLocale[token];
|
|
|
|
if (typeof format === "function") {
|
|
return format(date, baseDate, options);
|
|
}
|
|
|
|
return format;
|
|
};
|