Module

JS.Temporal.PlainDate

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

A calendar date (year, month, day) without time or time zone. Use for date-only values (e.g. birthdays, all-day events). Uses ISO 8601 calendar by default.

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

#add Source

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

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

#add_ Source

add_ :: Duration -> PlainDate -> Effect PlainDate

Same as add with default options.

#daysInMonth Source

#from Source

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

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

#fromDate Source

fromDate :: Date -> Effect PlainDate

Converts a purescript-datetime Date to a PlainDate. See docs/purescript-datetime-interop.md.

#from_ Source

from_ :: String -> Effect PlainDate

Same as from with default options.

#monthsInYear Source

#new Source

new :: Int -> Int -> Int -> Effect PlainDate

Creates a PlainDate from year, month, day. Throws if invalid.

#since Source

since :: forall provided. ConvertOptionsWithDefaults ToDifferenceOptions (Record DifferenceOptions) (Record provided) (Record DifferenceOptions) => Record provided -> PlainDate -> PlainDate -> Effect Duration

Duration from the other date to this one (inverse of until).

#since_ Source

since_ :: PlainDate -> PlainDate -> Effect Duration

Same as since with default options.

#subtract Source

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

Subtracts a duration from a date. Options: overflow.

#subtract_ Source

subtract_ :: Duration -> PlainDate -> Effect PlainDate

Same as subtract with default options.

#toDate Source

toDate :: PlainDate -> Date

Converts a PlainDate to a purescript-datetime Date. See docs/purescript-datetime-interop.md.

#toPlainDateTime Source

toPlainDateTime :: PlainTime -> PlainDate -> PlainDateTime

Combines a PlainTime with this date to form a PlainDateTime.

#toPlainMonthDay Source

toPlainMonthDay :: PlainDate -> PlainMonthDay

Drops the year component.

#toZonedDateTime Source

toZonedDateTime :: String -> PlainDate -> Effect ZonedDateTime

Converts to ZonedDateTime at midnight in the given time zone.

#toPlainYearMonth Source

toPlainYearMonth :: PlainDate -> PlainYearMonth

Drops the day component.

#toString Source

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

Serializes to ISO 8601 date format. Options: calendarName.

#toString_ Source

toString_ :: PlainDate -> String

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

#until Source

until :: forall provided. ConvertOptionsWithDefaults ToDifferenceOptions (Record DifferenceOptions) (Record provided) (Record DifferenceOptions) => Record provided -> PlainDate -> PlainDate -> Effect Duration

Duration from this date until the other. Options: largestUnit, smallestUnit, roundingIncrement, roundingMode.

#until_ Source

until_ :: PlainDate -> PlainDate -> Effect Duration

Same as until 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 -> PlainDate -> Effect PlainDate

Returns a new PlainDate with specified fields replaced. Options: overflow.

#withCalendar Source

withCalendar :: String -> PlainDate -> Effect PlainDate

Returns a new PlainDate with the given calendar (e.g. "iso8601").

#with_ Source

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

Same as with with default options.

Re-exports from JS.Temporal.PlainDate.Internal