cjs β’ Lines: 194"use strict";
exports.formatDistance = void 0;
const formatDistanceLocale = {
lessThanXSeconds: {
one: {
standalone: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ 1 ΡΠ΅ΠΊΡΠ½Π΄Π΅",
withPrepositionAgo: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ 1 ΡΠ΅ΠΊΡΠ½Π΄Π΅",
withPrepositionIn: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ 1 ΡΠ΅ΠΊΡΠ½Π΄Ρ",
},
dual: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ {{count}} ΡΠ΅ΠΊΡΠ½Π΄Π΅",
other: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ {{count}} ΡΠ΅ΠΊΡΠ½Π΄ΠΈ",
},
xSeconds: {
one: {
standalone: "1 ΡΠ΅ΠΊΡΠ½Π΄Π°",
withPrepositionAgo: "1 ΡΠ΅ΠΊΡΠ½Π΄Π΅",
withPrepositionIn: "1 ΡΠ΅ΠΊΡΠ½Π΄Ρ",
},
dual: "{{count}} ΡΠ΅ΠΊΡΠ½Π΄Π΅",
other: "{{count}} ΡΠ΅ΠΊΡΠ½Π΄ΠΈ",
},
halfAMinute: "ΠΏΠΎΠ»Π° ΠΌΠΈΠ½ΡΡΠ΅",
lessThanXMinutes: {
one: {
standalone: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ 1 ΠΌΠΈΠ½ΡΡΠ΅",
withPrepositionAgo: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ 1 ΠΌΠΈΠ½ΡΡΠ΅",
withPrepositionIn: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ 1 ΠΌΠΈΠ½ΡΡΡ",
},
dual: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ {{count}} ΠΌΠΈΠ½ΡΡΠ΅",
other: "ΠΌΠ°ΡΠ΅ ΠΎΠ΄ {{count}} ΠΌΠΈΠ½ΡΡΠ°",
},
xMinutes: {
one: {
standalone: "1 ΠΌΠΈΠ½ΡΡΠ°",
withPrepositionAgo: "1 ΠΌΠΈΠ½ΡΡΠ΅",
withPrepositionIn: "1 ΠΌΠΈΠ½ΡΡΡ",
},
dual: "{{count}} ΠΌΠΈΠ½ΡΡΠ΅",
other: "{{count}} ΠΌΠΈΠ½ΡΡΠ°",
},
aboutXHours: {
one: {
standalone: "ΠΎΠΊΠΎ 1 ΡΠ°Ρ",
withPrepositionAgo: "ΠΎΠΊΠΎ 1 ΡΠ°Ρ",
withPrepositionIn: "ΠΎΠΊΠΎ 1 ΡΠ°Ρ",
},
dual: "ΠΎΠΊΠΎ {{count}} ΡΠ°ΡΠ°",
other: "ΠΎΠΊΠΎ {{count}} ΡΠ°ΡΠΈ",
},
xHours: {
one: {
standalone: "1 ΡΠ°Ρ",
withPrepositionAgo: "1 ΡΠ°Ρ",
withPrepositionIn: "1 ΡΠ°Ρ",
},
dual: "{{count}} ΡΠ°ΡΠ°",
other: "{{count}} ΡΠ°ΡΠΈ",
},
xDays: {
one: {
standalone: "1 Π΄Π°Π½",
withPrepositionAgo: "1 Π΄Π°Π½",
withPrepositionIn: "1 Π΄Π°Π½",
},
dual: "{{count}} Π΄Π°Π½Π°",
other: "{{count}} Π΄Π°Π½Π°",
},
aboutXWeeks: {
one: {
standalone: "ΠΎΠΊΠΎ 1 Π½Π΅Π΄Π΅ΡΡ",
withPrepositionAgo: "ΠΎΠΊΠΎ 1 Π½Π΅Π΄Π΅ΡΡ",
withPrepositionIn: "ΠΎΠΊΠΎ 1 Π½Π΅Π΄Π΅ΡΡ",
},
dual: "ΠΎΠΊΠΎ {{count}} Π½Π΅Π΄Π΅ΡΠ΅",
other: "ΠΎΠΊΠΎ {{count}} Π½Π΅Π΄Π΅ΡΠ΅",
},
xWeeks: {
one: {
standalone: "1 Π½Π΅Π΄Π΅ΡΡ",
withPrepositionAgo: "1 Π½Π΅Π΄Π΅ΡΡ",
withPrepositionIn: "1 Π½Π΅Π΄Π΅ΡΡ",
},
dual: "{{count}} Π½Π΅Π΄Π΅ΡΠ΅",
other: "{{count}} Π½Π΅Π΄Π΅ΡΠ΅",
},
aboutXMonths: {
one: {
standalone: "ΠΎΠΊΠΎ 1 ΠΌΠ΅ΡΠ΅Ρ",
withPrepositionAgo: "ΠΎΠΊΠΎ 1 ΠΌΠ΅ΡΠ΅Ρ",
withPrepositionIn: "ΠΎΠΊΠΎ 1 ΠΌΠ΅ΡΠ΅Ρ",
},
dual: "ΠΎΠΊΠΎ {{count}} ΠΌΠ΅ΡΠ΅ΡΠ°",
other: "ΠΎΠΊΠΎ {{count}} ΠΌΠ΅ΡΠ΅ΡΠΈ",
},
xMonths: {
one: {
standalone: "1 ΠΌΠ΅ΡΠ΅Ρ",
withPrepositionAgo: "1 ΠΌΠ΅ΡΠ΅Ρ",
withPrepositionIn: "1 ΠΌΠ΅ΡΠ΅Ρ",
},
dual: "{{count}} ΠΌΠ΅ΡΠ΅ΡΠ°",
other: "{{count}} ΠΌΠ΅ΡΠ΅ΡΠΈ",
},
aboutXYears: {
one: {
standalone: "ΠΎΠΊΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
withPrepositionAgo: "ΠΎΠΊΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
withPrepositionIn: "ΠΎΠΊΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
},
dual: "ΠΎΠΊΠΎ {{count}} Π³ΠΎΠ΄ΠΈΠ½Π΅",
other: "ΠΎΠΊΠΎ {{count}} Π³ΠΎΠ΄ΠΈΠ½Π°",
},
xYears: {
one: {
standalone: "1 Π³ΠΎΠ΄ΠΈΠ½Π°",
withPrepositionAgo: "1 Π³ΠΎΠ΄ΠΈΠ½Π΅",
withPrepositionIn: "1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
},
dual: "{{count}} Π³ΠΎΠ΄ΠΈΠ½Π΅",
other: "{{count}} Π³ΠΎΠ΄ΠΈΠ½Π°",
},
overXYears: {
one: {
standalone: "ΠΏΡΠ΅ΠΊΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
withPrepositionAgo: "ΠΏΡΠ΅ΠΊΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
withPrepositionIn: "ΠΏΡΠ΅ΠΊΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
},
dual: "ΠΏΡΠ΅ΠΊΠΎ {{count}} Π³ΠΎΠ΄ΠΈΠ½Π΅",
other: "ΠΏΡΠ΅ΠΊΠΎ {{count}} Π³ΠΎΠ΄ΠΈΠ½Π°",
},
almostXYears: {
one: {
standalone: "Π³ΠΎΡΠΎΠ²ΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
withPrepositionAgo: "Π³ΠΎΡΠΎΠ²ΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
withPrepositionIn: "Π³ΠΎΡΠΎΠ²ΠΎ 1 Π³ΠΎΠ΄ΠΈΠ½Ρ",
},
dual: "Π³ΠΎΡΠΎΠ²ΠΎ {{count}} Π³ΠΎΠ΄ΠΈΠ½Π΅",
other: "Π³ΠΎΡΠΎΠ²ΠΎ {{count}} Π³ΠΎΠ΄ΠΈΠ½Π°",
},
};
const formatDistance = (token, count, options) => {
let result;
const tokenValue = formatDistanceLocale[token];
if (typeof tokenValue === "string") {
result = tokenValue;
} else if (count === 1) {
if (options?.addSuffix) {
if (options.comparison && options.comparison > 0) {
result = tokenValue.one.withPrepositionIn;
} else {
result = tokenValue.one.withPrepositionAgo;
}
} else {
result = tokenValue.one.standalone;
}
} else if (
count % 10 > 1 &&
count % 10 < 5 && // if last digit is between 2 and 4
String(count).substr(-2, 1) !== "1" // unless the 2nd to last digit is "1"
) {
result = tokenValue.dual.replace("{{count}}", String(count));
} else {
result = tokenValue.other.replace("{{count}}", String(count));
}
if (options?.addSuffix) {
if (options.comparison && options.comparison > 0) {
return "Π·Π° " + result;
} else {
return "ΠΏΡΠ΅ " + result;
}
}
return result;
};
exports.formatDistance = formatDistance;