MCPcopy
hub / github.com/date-fns/date-fns / formatDistance

Function formatDistance

pkgs/core/src/locale/km/_lib/formatDistance/index.ts:24–42  ·  view source on GitHub ↗
(token, count, options)

Source from the content-addressed store, hash-verified

22};
23
24export const formatDistance: FormatDistanceFn = (token, count, options) => {
25 const tokenValue = formatDistanceLocale[token];
26
27 let result = tokenValue;
28
29 if (typeof count === "number") {
30 result = result.replace("{{count}}", count.toString());
31 }
32
33 if (options?.addSuffix) {
34 if (options.comparison && options.comparison > 0) {
35 return "ក្នុងរយៈពេល " + result;
36 } else {
37 return result + "មុន";
38 }
39 }
40
41 return result;
42};

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected