DayPilot.Date.toDateLocal

The toDateLocal() method returns a Date object that holds the DayPilot.Date value as a local date.

Declaration

DayPilot.Date.toDateLocal()

Return Value

Returns a Date object that represents the DayPilot.Date value as a local date/time.

Notes

The returned object uses the local time zone of the browser. As shown in the example below, serializing it using toISOString() can produce a different UTC timestamp than the original DayPilot.Date string.

Example

const today = DayPilot.Date.today();              // DayPilot.Date {value: "2018-01-01T00:00:00"}
const todayString = today.toString();            // "2018-01-01T00:00:00"

const localToday = today.toDateLocal();          // Mon Jan 01 2018 00:00:00 GMT+0100 (Central European Standard Time)
const localTodayString = localToday.toISOString(); // "2017-12-31T23:00:00.000Z"

See Also

DayPilot.Date Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript