Rest
...params: [string] | [Date] | [number, number, number]// equiv. to `new DataAPIDate('2004-09-14')`
date('2004-09-14')
// equiv. to `new DataAPIDate(2004, 9, 14)`
date(2004, 9, 14)
// equiv. to `DataAPIDate.now()`
date.now()
The current date in the local timezone
const now = date.now();
// or
const now = DataAPIDate.now()
Creates a DataAPIDate
from the number of days since the epoch.
The number may be negative, but must be an integer within the range [-100_000_000, 100_000_000]
.
The number of days since the epoch (may be negative)
The date representing the given number of days since the epoch
DataAPIDate.ofEpochDay(0) // '1970-01-01'
date.ofEpochDay(12675) // '2004-09-14'
date.ofEpochDay(-1) // '1969-12-31'
Creates a DataAPIDate
from a year and a valid day of the year.
The year may be negative.
The day-of-year must be valid for the year, otherwise an exception will be thrown.
The year to use
The day of the year to use (1-indexed)
The date representing the given year and day of the year
DataAPIDate.ofYearDay(2004, 258) // 2004-09-14
date.ofYearDay(2004, 1) // 2004-01-01
date.ofYearDay(2004, 366) // 2004-12-31 (ok b/c 2004 is a leap year)
The current date in UTC
const now = date.utcnow();
// or
const now = DataAPIDate.utcnow()
Overview
A shorthand function-object for DataAPIDate. May be used anywhere when creating new
DataAPIDate
s.See DataAPIDate and its methods for information about input parameters, formats, functions, etc.