Hyperlinkv0.8.0-beta.28

DateTime

DateTime.fromDateUnsafeconsteffect/DateTime.ts:617
(date: Date): Utc

Create a DateTime from a Date.

Details

If the Date is invalid, an IllegalArgumentError will be thrown.

Example (Creating DateTime values from Dates)

import { DateTime } from "effect"

const date = new Date("2024-01-01T12:00:00Z")
const dateTime = DateTime.fromDateUnsafe(date)

console.log(DateTime.formatIso(dateTime)) // "2024-01-01T12:00:00.000Z"
constructors
export const fromDateUnsafe: (date: Date) => Utc = Internal.fromDateUnsafe
Referenced by 1 symbols