Temporal.Internal.Types
- Package
- purescript-temporal
- Repository
- philippedev101/purescript-temporal
Internal module defining foreign Temporal types with their core typeclass
instances. These types are re-exported from their respective modules
(e.g. Temporal.Duration, Temporal.Instant, etc.).
#Duration Source
data DurationA length of time expressed as a combination of date and time components (years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds). All components must share the same sign.
Durations are unbalanced — { hours: 36 } is not automatically
converted to { days: 1, hours: 12 }. Use round to balance.
Eq compares component-by-component (not total elapsed time), so
{ hours: 1 } is not equal to { minutes: 60 }.
Instances
#Instant Source
data InstantAn exact moment on the UTC timeline with nanosecond precision, independent of any time zone or calendar.
Use Instant for timestamps, event logs, and any case where you need
an unambiguous point in time. Convert to ZonedDateTime when you need
wall-clock representation in a specific time zone.
Instances
#PlainDateTime Source
data PlainDateTimeA calendar date and wall-clock time without a time zone (e.g. 2024-03-15T10:30:00).
Use PlainDateTime for events whose time zone is tracked separately,
or for wall-clock displays. For unambiguous moments in time, use Instant
or ZonedDateTime instead.
Instances
#PlainYearMonth Source
data PlainYearMonthA year and month without a day component (e.g. 2024-03).
Useful for representing months in a calendar UI or credit card expiry dates.
Instances
#PlainMonthDay Source
data PlainMonthDayA month and day without a year component (e.g. 12-25).
Useful for recurring annual dates like birthdays or holidays.
Instances
#ZonedDateTime Source
data ZonedDateTimeA date and time in a specific time zone, with full awareness of UTC offset and DST transitions (e.g. 2024-03-15T10:30:00-04:00[America/New_York]).
This is the richest Temporal type. Use it for scheduling future events
where wall-clock time should be preserved even if DST rules change.
For past events or timestamps, Instant is usually sufficient.
Instances
#durationToString Source
durationToString :: Duration -> String#instantToString Source
instantToString :: Instant -> String#plainDateToString Source
plainDateToString :: PlainDate -> String#plainTimeToString Source
plainTimeToString :: PlainTime -> String