๐Ÿ“„ formatDistance.js
/home/palash/git/site/node_modules/date-fns/locale/gu/_lib/formatDistance.js
Language: 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;
};