(self: DateTime): stringFormats a DateTime.Zoned as an ISO string with an offset.
Details
For DateTime.Utc, returns the same as formatIso. For DateTime.Zoned,
includes the time zone offset in the format.
Example (Formatting DateTime values with offsets)
import { DateTime } from "effect"
const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
console.log(DateTime.formatIsoOffset(utc)) // "2024-01-01T12:00:00.000Z"
const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)
})
console.log(DateTime.formatIsoOffset(zoned)) // "2024-01-01T15:00:00.000+03:00"formatting
Source effect/DateTime.ts:27721 lines
export const const formatIsoOffset: (
self: DateTime
) => string
Formats a DateTime.Zoned as an ISO string with an offset.
Details
For DateTime.Utc, returns the same as formatIso. For DateTime.Zoned,
includes the time zone offset in the format.
Example (Formatting DateTime values with offsets)
import { DateTime } from "effect"
const utc = DateTime.makeUnsafe("2024-01-01T12:00:00Z")
console.log(DateTime.formatIsoOffset(utc)) // "2024-01-01T12:00:00.000Z"
const zoned = DateTime.makeZonedUnsafe("2024-01-01T12:00:00Z", {
timeZone: DateTime.zoneMakeOffset(3 * 60 * 60 * 1000)
})
console.log(DateTime.formatIsoOffset(zoned)) // "2024-01-01T15:00:00.000+03:00"
formatIsoOffset: (self: DateTimeself: type DateTime = Utc | ZonedA DateTime represents a point in time. It can optionally have a time zone
associated with it.
Companion namespace containing the public helper types used by DateTime
constructors, parts APIs, formatting, and date/time arithmetic.
DateTime) => string = import InternalInternal.const formatIsoOffset: (
self: DateTime.DateTime
) => string
formatIsoOffset