(date: Date): UtcCreate 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
Source effect/DateTime.ts:6171 lines
export const const fromDateUnsafe: (date: Date) => UtcCreate 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"
fromDateUnsafe: (date: Datedate: Date) => Utc = import InternalInternal.const fromDateUnsafe: (
date: Date
) => DateTime.Utc
fromDateUnsafeReferenced by 1 symbols