MCPcopy Index your code
hub / github.com/github/relative-time-element / compare

Method compare

src/duration.ts:75–80  ·  view source on GitHub ↗
(one: unknown, two: unknown)

Source from the content-addressed store, hash-verified

73 }
74
75 static compare(one: unknown, two: unknown): -1 | 0 | 1 {
76 const now = Date.now()
77 const oneApplied = Math.abs(applyDuration(now, Duration.from(one)).getTime() - now)
78 const twoApplied = Math.abs(applyDuration(now, Duration.from(two)).getTime() - now)
79 return oneApplied > twoApplied ? -1 : oneApplied < twoApplied ? 1 : 0
80 }
81
82 toLocaleString(locale: string, opts: DurationFormatOptions) {
83 return new DurationFormat(locale, opts).format(this)

Callers 2

duration.tsFile · 0.80
#resolveFormatMethod · 0.80

Calls 3

applyDurationFunction · 0.85
absMethod · 0.80
fromMethod · 0.80

Tested by

no test coverage detected