Module Js.Date

Provide bindings for JS Date

JavaScript Date API

type t;
let valueOf: t => float;

returns the primitive value of this date, equivalent to getTime

let make: unit => t;

returns a date representing the current time

let fromFloat: float => t;
let fromString: string => t;
let makeWithYM: year:float => month:float => t;
let makeWithYMD: year:float => month:float => date:float => t;
let makeWithYMDH: year:float => month:float => date:float => hours:float => t;
let makeWithYMDHM: year:float => month:float => date:float => hours:float => minutes:float => t;
let makeWithYMDHMS: year:float => month:float => date:float => hours:float => minutes:float => seconds:float => t;
let utcWithYM: year:float => month:float => float;
let utcWithYMD: year:float => month:float => date:float => float;
let utcWithYMDH: year:float => month:float => date:float => hours:float => float;
let utcWithYMDHM: year:float => month:float => date:float => hours:float => minutes:float => float;
let utcWithYMDHMS: year:float => month:float => date:float => hours:float => minutes:float => seconds:float => float;
let now: unit => float;

returns the number of milliseconds since Unix epoch

let parseAsFloat: string => float;

returns NaN if passed invalid date string

let getDate: t => float;

return the day of the month (1-31)

let getDay: t => float;

returns the day of the week (0-6)

let getFullYear: t => float;
let getHours: t => float;
let getMilliseconds: t => float;
let getMinutes: t => float;
let getMonth: t => float;

returns the month (0-11)

let getSeconds: t => float;
let getTime: t => float;

returns the number of milliseconds since Unix epoch

let getTimezoneOffset: t => float;
let getUTCDate: t => float;

return the day of the month (1-31)

let getUTCDay: t => float;

returns the day of the week (0-6)

let getUTCFullYear: t => float;
let getUTCHours: t => float;
let getUTCMilliseconds: t => float;
let getUTCMinutes: t => float;
let getUTCMonth: t => float;

returns the month (0-11)

let getUTCSeconds: t => float;
let setDate: float => t => float;
let setFullYear: float => t => float;
let setFullYearM: year:float => month:float => t => float;
let setFullYearMD: year:float => month:float => date:float => t => float;
let setHours: float => t => float;
let setHoursM: hours:float => minutes:float => t => float;
let setHoursMS: hours:float => minutes:float => seconds:float => t => float;
let setHoursMSMs: hours:float => minutes:float => seconds:float => milliseconds:float => t => float;
let setMilliseconds: float => t => float;
let setMinutes: float => t => float;
let setMinutesS: minutes:float => seconds:float => t => float;
let setMinutesSMs: minutes:float => seconds:float => milliseconds:float => t => float;
let setMonth: float => t => float;
let setMonthD: month:float => date:float => t => float;
let setSeconds: float => t => float;
let setSecondsMs: seconds:float => milliseconds:float => t => float;
let setTime: float => t => float;
let setUTCDate: float => t => float;
let setUTCFullYear: float => t => float;
let setUTCFullYearM: year:float => month:float => t => float;
let setUTCFullYearMD: year:float => month:float => date:float => t => float;
let setUTCHours: float => t => float;
let setUTCHoursM: hours:float => minutes:float => t => float;
let setUTCHoursMS: hours:float => minutes:float => seconds:float => t => float;
let setUTCHoursMSMs: hours:float => minutes:float => seconds:float => milliseconds:float => t => float;
let setUTCMilliseconds: float => t => float;
let setUTCMinutes: float => t => float;
let setUTCMinutesS: minutes:float => seconds:float => t => float;
let setUTCMinutesSMs: minutes:float => seconds:float => milliseconds:float => t => float;
let setUTCMonth: float => t => float;
let setUTCMonthD: month:float => date:float => t => float;
let setUTCSeconds: float => t => float;
let setUTCSecondsMs: seconds:float => milliseconds:float => t => float;
let setUTCTime: float => t => float;
let toDateString: t => string;
let toISOString: t => string;
let toJSON: t => option(string);
let toJSONUnsafe: t => string;
let toLocaleDateString: t => string;
let toLocaleString: t => string;
let toLocaleTimeString: t => string;
let toString: t => string;
let toTimeString: t => string;
let toUTCString: t => string;