miso
Copyright(C) 2016-2025 David M. Johnson (@dmjio)
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Date

Description

Mutable Date data structure in IO.

A JavaScript Date. This is a convenience for manipulating JavaScript data structures from Haskell.

We recommend using this module qualified.

import qualified Miso.Date as D
Synopsis

Type

data Date Source #

Instances

Instances details
Eq Date Source # 
Instance details

Defined in Miso.Date

Methods

(==) :: Date -> Date -> Bool #

(/=) :: Date -> Date -> Bool #

FromJSVal Date Source # 
Instance details

Defined in Miso.Date

ToJSVal Date Source # 
Instance details

Defined in Miso.Date

Methods

toJSVal :: Date -> IO JSVal Source #

ToObject Date Source # 
Instance details

Defined in Miso.Date

Methods

toObject :: Date -> IO Object Source #

Construction

new :: IO Date Source #

Constructs a new JS Date in IO.

Conversion

Getters

getDate :: Date -> IO Int Source #

Returns the day of the month.

getDay :: Date -> IO Int Source #

Returns the day of the week.

getFullYear :: Date -> IO Int Source #

Returns the full year.

getHours :: Date -> IO Int Source #

Returns the hour.

getMilliseconds :: Date -> IO Int Source #

Returns the milliseconds.

getMinutes :: Date -> IO Int Source #

Returns the minutes.

getMonth :: Date -> IO Int Source #

Returns the month (0-11).

getSeconds :: Date -> IO Int Source #

Returns the seconds.

getTime :: Date -> IO Double Source #

Returns milliseconds since epoch.

getTimezoneOffset :: Date -> IO Int Source #

Returns the time zone offset in minutes.

getUTCDate :: Date -> IO Int Source #

Returns the UTC day of the month.

getUTCDay :: Date -> IO Int Source #

Returns the UTC day of the week.

getUTCFullYear :: Date -> IO Int Source #

Returns the UTC full year.

getUTCHours :: Date -> IO Int Source #

Returns the UTC hour.

getUTCMilliseconds :: Date -> IO Int Source #

Returns the UTC milliseconds.

getUTCMinutes :: Date -> IO Int Source #

Returns the UTC minutes.

getUTCMonth :: Date -> IO Int Source #

Returns the UTC month (0-11).

getUTCSeconds :: Date -> IO Int Source #

Returns the UTC seconds.

Setters

setDate :: Int -> Date -> IO Double Source #

Sets the day of the month.

setFullYear :: Int -> Maybe Int -> Maybe Int -> Date -> IO Double Source #

Sets the full year, with optional month and day.

setHours :: Int -> Maybe Int -> Maybe Int -> Maybe Int -> Date -> IO Double Source #

Sets the hour, with optional minutes, seconds, and milliseconds.

setMilliseconds :: Int -> Date -> IO Double Source #

Sets the milliseconds.

setMinutes :: Int -> Maybe Int -> Maybe Int -> Date -> IO Double Source #

Sets the minutes, with optional seconds and milliseconds.

setMonth :: Int -> Maybe Int -> Date -> IO Double Source #

Sets the month, with optional day of the month.

setSeconds :: Int -> Maybe Int -> Date -> IO Double Source #

Sets the seconds, with optional milliseconds.

setTime :: Double -> Date -> IO Double Source #

Sets the time in milliseconds since epoch.

setUTCDate :: Int -> Date -> IO Double Source #

Sets the UTC day of the month.

setUTCFullYear :: Int -> Maybe Int -> Maybe Int -> Date -> IO Double Source #

Sets the UTC full year, with optional month and day.

setUTCHours :: Int -> Maybe Int -> Maybe Int -> Maybe Int -> Date -> IO Double Source #

Sets the UTC hour, with optional minutes, seconds, and milliseconds.

setUTCMilliseconds :: Int -> Date -> IO Double Source #

Sets the UTC milliseconds.

setUTCMinutes :: Int -> Maybe Int -> Maybe Int -> Date -> IO Double Source #

Sets the UTC minutes, with optional seconds and milliseconds.

setUTCMonth :: Int -> Maybe Int -> Date -> IO Double Source #

Sets the UTC month, with optional day of the month.

setUTCSeconds :: Int -> Maybe Int -> Date -> IO Double Source #

Sets the UTC seconds, with optional milliseconds.