js โข Lines: 102// Source: https://www.unicode.org/cldr/charts/32/summary/gu.html
const formatDistanceLocale = {
lessThanXSeconds: {
one: "เชนเชฎเชฃเชพเช", // CLDR #1461
other: "โเชเชถเชฐเซ {{count}} เชธเซเชเชเชก",
},
xSeconds: {
one: "1 เชธเซเชเชเชก",
other: "{{count}} เชธเซเชเชเชก",
},
halfAMinute: "เช
เชกเชงเซ เชฎเชฟเชจเชฟเช",
lessThanXMinutes: {
one: "เช เชฎเชฟเชจเชฟเช", // CLDR #1448
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) {
if (options.comparison && options.comparison > 0) {
return result + "เชฎเชพเช";
} else {
return result + " เชชเชนเซเชฒเชพเช";
}
}
return result;
};