Module

Data.Date

Package
purescript-datetime
Repository
purescript/purescript-datetime

#Date Source

data Date

A date value in the Gregorian calendar.

Instances

#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.

#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.

#year Source

year :: Date -> Year

The year component of a date value.

#month Source

month :: Date -> Month

The month component of a date value.

#day Source

day :: Date -> Day

The day component of a date value.

#weekday Source

weekday :: Date -> Weekday

The weekday for a date value.

#diff Source

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

Calculates the difference between two dates, returning the result as a duration.

#isLeapYear Source

isLeapYear :: Year -> Boolean

Checks whether a year is a leap year according to the proleptic Gregorian calendar.

#lastDayOfMonth Source

lastDayOfMonth :: Year -> Month -> Day

Get the final day of a month and year, accounting for leap years.

#adjust Source

adjust :: Days -> Date -> Maybe Date

Adjusts a date with a Duration in days. The number of days must already be an integer and fall within the valid range of values for the Int type.

Re-exports from Data.Date.Component

#Year Source

newtype Year

A year component for a date.

The constructor is private as the Year type is bounded to the range -271820 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