The DayPilot.Date constructor creates a new immutable DayPilot date/time value from the current time, an ISO 8601 string, or a JavaScript Date object.
Declaration
new DayPilot.Date()new DayPilot.Date(value)new DayPilot.Date(date, isLocal)Parameters
value(string) - date/time value in ISO 8601 format.date (Date)- JavaScript object used to set the initial value. If it isnull, the current local date and time are used.isLocal(boolean) - iftrue, thedateparameter is read as local time; iffalse, the GMT base ofdateis used.
Possible Values
"2035-01-01"- ISO 8601 date without time."2035-01-01T00:00:00"- ISO 8601 date/time without milliseconds."2035-01-01T00:00:00.000"- ISO 8601 date/time with milliseconds."2035-01-01T00:00:00Z"- ISO 8601 date/time with a UTC suffix."2035-01-01T00:00:00.000Z"- ISO 8601 date/time with milliseconds and a UTC suffix."2035-01-01T00:00:00+01:00"- ISO 8601 date/time with an offset suffix."2035-01-01T00:00:00.000+01:00"- ISO 8601 date/time with milliseconds and an offset suffix.date (Date)- JavaScript Date object accepted by the overloaded constructor.date- value read as local time whenisLocalistrue; otherwise the GMT base is used.
Notes
DayPilot.Date() creates a new instance using the current local date and time.
DayPilot.Date(value) creates a new instance using a date specified in ISO 8601 format such as "2035-01-01T00:00:00".
Accepted formats:
"2035-01-01""2035-01-01T00:00:00""2035-01-01T00:00:00.000""2035-01-01T00:00:00Z""2035-01-01T00:00:00.000Z""2035-01-01T00:00:00+01:00""2035-01-01T00:00:00.000+01:00"
DayPilot works with a single idealized timezone, so it is recommended to use date/time formats without explicit time zone information. See also Time Zones [doc.daypilot.org].
DayPilot.Date(date, isLocal) creates a new instance from a JavaScript Date object.
Example
const now = new DayPilot.Date();
const fromString = new DayPilot.Date("2035-01-01T00:00:00");
const fromDate = new DayPilot.Date(new Date(), true);See Also
Time Zones [doc.daypilot.org]
Client-Side Event API [doc.daypilot.org]
Availability
Availability of this API item in DayPilot editions:
| Product | Lite | Pro |
|---|---|---|
| DayPilot for JavaScript |
DayPilot