Files
klz-cables.com/.pnpm-store/v10/files/31/8cef81287537a663105acb72050708811fdfd10c6435ed9a6f19bf6c5b90c4b0e5a4a7c4f2dd6dd9c51e90e1ee4506a300aebb127c87826f76596232aba4cb
Marc Mintel 5397309103
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
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

140 lines
3.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const formatDistanceLocale = {
lessThanXSeconds: {
one: "секунд хүрэхгүй",
other: "{{count}} секунд хүрэхгүй",
},
xSeconds: {
one: "1 секунд",
other: "{{count}} секунд",
},
halfAMinute: "хагас минут",
lessThanXMinutes: {
one: "минут хүрэхгүй",
other: "{{count}} минут хүрэхгүй",
},
xMinutes: {
one: "1 минут",
other: "{{count}} минут",
},
aboutXHours: {
one: "ойролцоогоор 1 цаг",
other: "ойролцоогоор {{count}} цаг",
},
xHours: {
one: "1 цаг",
other: "{{count}} цаг",
},
xDays: {
one: "1 өдөр",
other: "{{count}} өдөр",
},
aboutXWeeks: {
one: "ойролцоогоор 1 долоо хоног",
other: "ойролцоогоор {{count}} долоо хоног",
},
xWeeks: {
one: "1 долоо хоног",
other: "{{count}} долоо хоног",
},
aboutXMonths: {
one: "ойролцоогоор 1 сар",
other: "ойролцоогоор {{count}} сар",
},
xMonths: {
one: "1 сар",
other: "{{count}} сар",
},
aboutXYears: {
one: "ойролцоогоор 1 жил",
other: "ойролцоогоор {{count}} жил",
},
xYears: {
one: "1 жил",
other: "{{count}} жил",
},
overXYears: {
one: "1 жил гаран",
other: "{{count}} жил гаран",
},
almostXYears: {
one: "бараг 1 жил",
other: "бараг {{count}} жил",
},
};
export const formatDistance = (token, count, options) => {
let result;
const tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === "string") {
result = tokenValue;
} else if (count === 1) {
result = tokenValue.one;
} else {
result = tokenValue.other.replace("{{count}}", String(count));
}
if (options?.addSuffix) {
/**
* Append genitive case
*/
const words = result.split(" ");
const lastword = words.pop();
result = words.join(" ");
switch (lastword) {
case "секунд":
result += " секундийн";
break;
case "минут":
result += " минутын";
break;
case "цаг":
result += " цагийн";
break;
case "өдөр":
result += " өдрийн";
break;
case "сар":
result += " сарын";
break;
case "жил":
result += " жилийн";
break;
case "хоног":
result += " хоногийн";
break;
case "гаран":
result += " гараны";
break;
case "хүрэхгүй":
result += " хүрэхгүй хугацааны";
break;
default:
result += lastword + "-н";
}
if (options.comparison && options.comparison > 0) {
return result + " дараа";
} else {
return result + " өмнө";
}
}
return result;
};