Package: effect
Module: DateTime
Formats a DateTime with Intl.DateTimeFormat using the system local time
zone and locale.
Example (Formatting DateTime values locally)
import { DateTime } from "effect"
const dt = DateTime.makeUnsafe("2024-06-15T14:30:00Z")
// Uses system local time zone and locale
const local = DateTime.formatLocal(dt, {
year: "numeric",
month: "long",
day: "numeric",
hour: "2-digit",
minute: "2-digit"
})
console.log(local) // Output depends on system locale/timezone
Signature
declare const formatLocal: { (options?: (Intl.DateTimeFormatOptions & { readonly locale?: string | undefined; }) | undefined): (self: DateTime) => string; (self: DateTime, options?: (Intl.DateTimeFormatOptions & { readonly locale?: string | undefined; }) | undefined): string; }
Since v3.6.0