Hyperlinkv0.8.0-beta.28

Duration

Duration.fromInputconsteffect/Duration.ts:330
(u: Input): Option.Option<Duration>

Decodes a Input value into a Duration safely, returning Option.none() if decoding fails.

Example (Safely decoding duration inputs)

import { Duration, Option } from "effect"

Duration.fromInput(1000).pipe(Option.map(Duration.toSeconds)) // Some(1)

Duration.fromInput("invalid" as any) // None
constructors
export const fromInput: (u: Input) => Option.Option<Duration> = Option.liftThrowable(
  fromInputUnsafe
)
Referenced by 1 symbols