(token, count, options)
| 22 | }; |
| 23 | |
| 24 | export 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 | }; |