Package: effect
Module: Duration
Valid input types that can be converted to a Duration.
When to use
Use when an API should accept any value that Effect can convert into a
Duration, including existing durations, millisecond numbers, nanosecond
bigints, high-resolution tuples, duration strings, infinity strings, or
duration objects.
Details
String inputs accept values like "10 seconds", "500 millis",
"Infinity", and "-Infinity". Finite fractional values that are
normalized to nanoseconds are rounded to the nearest nanosecond, with ties
away from zero.
See
fromInput for safe conversion to OptionfromInputUnsafe for throwing conversionDurationObject for object-shaped duration inputUnit for supported string unitsSignature
type Input = | Duration
| number // millis
| bigint // nanos
| readonly [seconds: number, nanos: number]
| `${number} ${Unit}`
| "Infinity"
| "-Infinity"
| DurationObject
Since v4.0.0