(input: string, scale: number)
| 75 | } |
| 76 | |
| 77 | const fromMillisString = (input: string, scale: number): Duration => { |
| 78 | const millis = Number(input) * scale |
| 79 | if (!Number.isFinite(millis)) return make(millis) |
| 80 | const nanos = parseNanos(input, BigInt(scale) * bigint1e6) |
| 81 | // Keep the millisecond representation only when it preserves the exact value. |
| 82 | return make(Number.isInteger(millis) && BigInt(millis) * bigint1e6 === nanos ? millis : nanos) |
| 83 | } |
| 84 | |
| 85 | const nanosToHrTime = (nanos: bigint): [seconds: number, nanos: number] => { |
| 86 | const sign = nanos < bigint0 ? -bigint1 : bigint1 |
no test coverage detected