InputValid 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.
export type type Input =
| number
| bigint
| Duration
| "Infinity"
| readonly [seconds: number, nanos: number]
| `${number} nano`
| `${number} nanos`
| `${number} micro`
| `${number} micros`
| `${number} milli`
| `${number} millis`
| `${number} second`
| `${number} seconds`
| `${number} minute`
| `${number} minutes`
| `${number} hour`
| `${number} hours`
| `${number} day`
| `${number} days`
| `${number} week`
| `${number} weeks`
| "-Infinity"
| DurationObject
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.
Input =
| Duration
| number // millis
| bigint // nanos
| readonly [numberseconds: number, numbernanos: number]
| `${number} ${type Unit =
| "nano"
| "nanos"
| "micro"
| "micros"
| "milli"
| "millis"
| "second"
| "seconds"
| "minute"
| "minutes"
| "hour"
| "hours"
| "day"
| "days"
| "week"
| "weeks"
Valid time units that can be used in duration string representations.
When to use
Use when typing the unit portion of duration string inputs accepted by
Duration.Input.
Unit}`
| "Infinity"
| "-Infinity"
| DurationObject