MCPcopy
hub / github.com/formatjs/formatjs / TimeClip

Function TimeClip

packages/ecma262-abstract/TimeClip.ts:23–31  ·  view source on GitHub ↗
(time: Decimal)

Source from the content-addressed store, hash-verified

21 * https://tc39.es/ecma262/#sec-timeclip
22 */
23export function TimeClip(time: Decimal): Decimal {
24 if (!time.isFinite()) {
25 return new Decimal(NaN)
26 }
27 if (time.abs().greaterThan(8.64 * 1e15)) {
28 return new Decimal(NaN)
29 }
30 return ToInteger(time)
31}

Callers 3

FormatDateTimePatternFunction · 0.85
PartitionDateTimePatternFunction · 0.85

Calls 4

ToIntegerFunction · 0.85
isFiniteMethod · 0.80
greaterThanMethod · 0.80
absMethod · 0.80

Tested by

no test coverage detected