Module

Data.DateTime

Package
datetime
Repository
purerl/purescript-datetime

#DateTime Source

data DateTime

A date/time value in the Gregorian calendar/UTC time zone.

Constructors

Instances

#modifyDate Source

#modifyDateF Source

modifyDateF :: forall f. Functor f => (Date -> f Date) -> DateTime -> f DateTime

#modifyTime Source

#modifyTimeF Source

modifyTimeF :: forall f. Functor f => (Time -> f Time) -> DateTime -> f DateTime

#adjust Source

adjust :: forall d. Duration d => d -> DateTime -> Maybe DateTime

Adjusts a date/time value with a duration offset. Nothing is returned if the resulting date would be outside of the range of valid dates.

#diff Source

diff :: forall d. Duration d => DateTime -> DateTime -> d

Calculates the difference between two date/time values, returning the result as a duration.

Re-exports from Data.Date

#Year Source

newtype Year

A year component for a date.

The constructor is private as the Year type is bounded to the range 0 to 275759, inclusive. The toEnum function can be used to safely acquire a year value from an integer.

Instances

#Weekday Source

data Weekday

A type representing the days of the week in the Gregorian calendar.

Constructors

Instances

#Day Source

newtype Day

A day component for a date.

The constructor is private as the Day type is bounded to the range 1 to 31, inclusive. The toEnum function can be used to safely acquire a day value from an integer.

Instances

#Date Source

data Date

A date value in the Gregorian calendar.

Instances

#year Source

year :: Date -> Year

The year component of a date value.

#weekday Source

weekday :: Date -> Weekday

The weekday for a date value.

#month Source

month :: Date -> Month

The month component of a date value.

#exactDate Source

exactDate :: Year -> Month -> Day -> Maybe Date

Constructs a date from year, month, and day components. The result will be Nothing if the provided values result in an invalid date.

#day Source

day :: Date -> Day

The day component of a date value.

#canonicalDate Source

canonicalDate :: Year -> Month -> Day -> Date

Constructs a date from year, month, and day components. The resulting date components may not be identical to the input values, as the date will be canonicalised according to the Gregorian calendar. For example, date values for the invalid date 2016-02-31 will be corrected to 2016-03-02.

Re-exports from Data.Time

#Second Source

newtype Second

An second component for a time value.

The constructor is private as values for the type are restricted to the range 0 to 59, inclusive. The toEnum function can be used to safely acquire an Second value from an integer. Correspondingly, a Second can be lowered to a plain integer with the fromEnum function.

Instances

#Minute Source

newtype Minute

An minute component for a time value.

The constructor is private as values for the type are restricted to the range 0 to 59, inclusive. The toEnum function can be used to safely acquire an Minute value from an integer. Correspondingly, a Minute can be lowered to a plain integer with the fromEnum function.

Instances

#Millisecond Source

newtype Millisecond

An millisecond component for a time value.

The constructor is private as values for the type are restricted to the range 0 to 999, inclusive. The toEnum function can be used to safely acquire an Millisecond value from an integer. Correspondingly, a Millisecond can be lowered to a plain integer with the fromEnum function.

Instances

#Hour Source

newtype Hour

An hour component for a time value.

The constructor is private as values for the type are restricted to the range 0 to 23, inclusive. The toEnum function can be used to safely acquire an Hour value from an integer. Correspondingly, an Hour can be lowered to a plain integer with the fromEnum function.

Instances

#setSecond Source

setSecond :: Second -> Time -> Time

Alters the second component of a time value.

#setMinute Source

setMinute :: Minute -> Time -> Time

Alters the minute component of a time value.

#setMillisecond Source

setMillisecond :: Millisecond -> Time -> Time

Alters the millisecond component of a time value.

#setHour Source

setHour :: Hour -> Time -> Time

Alters the hour component of a time value.

#second Source

second :: Time -> Second

The second component of a time value.

#minute Source

minute :: Time -> Minute

The minute component of a time value.

#millisecond Source

millisecond :: Time -> Millisecond

The millisecond component of a time value.

#hour Source

hour :: Time -> Hour

The hour component of a time value.