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

Function formatDistance

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

Source from the content-addressed store, hash-verified

87};
88
89export const formatDistance: FormatDistanceFn = (token, count, options) => {
90 let result;
91
92 const tokenValue = formatDistanceLocale[token];
93 if (typeof tokenValue === "string") {
94 result = tokenValue;
95 } else if (count === 1) {
96 result = tokenValue.one;
97 } else {
98 result = tokenValue.other.replace("{{count}}", count.toString());
99 }
100
101 if (options?.addSuffix) {
102 if (options.comparison && options.comparison > 0) {
103 return result + " 후";
104 } else {
105 return result + " 전";
106 }
107 }
108
109 return result;
110};

Callers

nothing calls this directly

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected