Module

JS.Temporal.PlainDateTime

Package
purescript-js-temporal
Repository
pete-murphy/purescript-js-temporal

A date and time (year, month, day, hour, minute, etc.) without time zone. Use for wall-clock times that are not tied to a specific instant (e.g. "Jan 15, 2024 at 3pm"). Combine with a time zone to get a ZonedDateTime.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime

#new Source

new :: forall provided rest. Union provided rest PlainDateTimeComponents => Record provided -> Effect PlainDateTime

Creates a PlainDateTime from component fields. Corresponds to Temporal.PlainDateTime().

#from Source

from :: forall provided. ConvertOptionsWithDefaults ToOverflowOptions (Record OverflowOptions) (Record provided) (Record OverflowOptions) => Record provided -> String -> Effect PlainDateTime

Parses a date-time string (e.g. "2024-01-15T15:30:00"). Options: overflow.

#from_ Source

from_ :: String -> Effect PlainDateTime

Same as from with default options.

#add Source

add :: forall provided. ConvertOptionsWithDefaults ToOverflowOptions (Record OverflowOptions) (Record provided) (Record OverflowOptions) => Record provided -> Duration -> PlainDateTime -> Effect PlainDateTime

Adds a duration. Supports calendar durations. Options: overflow.

#add_ Source

add_ :: Duration -> PlainDateTime -> Effect PlainDateTime

Same as add with default options.

#subtract Source

subtract :: forall provided. ConvertOptionsWithDefaults ToOverflowOptions (Record OverflowOptions) (Record provided) (Record OverflowOptions) => Record provided -> Duration -> PlainDateTime -> Effect PlainDateTime

Subtracts a duration. Options: overflow.

#subtract_ Source

subtract_ :: Duration -> PlainDateTime -> Effect PlainDateTime

Same as subtract with default options.

#with Source

with :: forall optsProvided fields rest. Union fields rest WithFields => ConvertOptionsWithDefaults ToOverflowOptions (Record OverflowOptions) (Record optsProvided) (Record OverflowOptions) => Record optsProvided -> Record fields -> PlainDateTime -> Effect PlainDateTime

#with_ Source

with_ :: forall fields rest. Union fields rest WithFields => Record fields -> PlainDateTime -> Effect PlainDateTime

#toString Source

toString :: forall provided. ConvertOptionsWithDefaults ToToStringOptions (Record ToStringOptions) (Record provided) (Record ToStringOptions) => Record provided -> PlainDateTime -> String

Serializes to ISO 8601 format. Options: fractionalSecondDigits, smallestUnit, roundingMode, calendarName.

#toString_ Source

toString_ :: PlainDateTime -> String

Default ISO 8601 serialization (no options). Prefer over toString {}.

#fromDateTime Source

fromDateTime :: DateTime -> Effect PlainDateTime

Converts a purescript-datetime DateTime to a PlainDateTime. See docs/purescript-datetime-interop.md.

#toDateTime Source

toDateTime :: PlainDateTime -> DateTime

Converts a PlainDateTime to a purescript-datetime DateTime. See docs/purescript-datetime-interop.md.

#toPlainDate Source

toPlainDate :: PlainDateTime -> PlainDate

Extracts the date component.

#toPlainTime Source

toPlainTime :: PlainDateTime -> PlainTime

Extracts the time component.

#toZonedDateTime Source

toZonedDateTime :: String -> PlainDateTime -> Effect ZonedDateTime

Interprets this date-time as occurring in the given time zone.

Re-exports from JS.Temporal.PlainDateTime.Internal