Switch to infinite scroll (Full book)

Other formatting

JS helpers that rely on the host timezone (avoid)

Those helpers ignore the timezone in which the event happened (which isn't stored by the JS Date). Instead, they display the event as it reads in the host machine timezone.

For example, an event that occurred at midnight in Paris is read as 7AM with no mention of midnight at all when the device is in the China timezone (getHours() on a China-based machine reads as 7.

pre-formatted strings (relying on the host machine timezone)

Note: those helpers don't accept a locale or an options object with a timezone.

date.toString()
// Sun Jun 12 2022 11:44:53 GMT+0200 (Central European Summer Time)

date.toDateString()
// Sun Jun 12 2022

date.toTimeString()
// 11:44:53 GMT+0200 (Central European Summer Time)

to UTC timezone ISO string

ISO8601 is an international standard. It indicates both the date component and the time component. It may provide the timezone.

birthDate.toISOString() // 2015-06-18T11:13:00.000Z
Date.parse("2015-06-18T11:13:00.000Z")

(optional) read calendar components

// the event occured on January 1st 2025, at 00:00 AM (Paris), device in China
birth.getFullYear() // 2025
birth.getMonth() // 0 (January)
birth.getDate() // 1 (for 1st)

birth.getHours() // 7
birth.getMinutes() // 0

// the UNIX Epoch instant
// Device in (Europe/Paris)
new Date(0).getHours() // 1
earlymorning logo

Other formatting

JS helpers that rely on the host timezone (avoid)

Those helpers ignore the timezone in which the event happened (which isn't stored by the JS Date). Instead, they display the event as it reads in the host machine timezone.

For example, an event that occurred at midnight in Paris is read as 7AM with no mention of midnight at all when the device is in the China timezone (getHours() on a China-based machine reads as 7.

pre-formatted strings (relying on the host machine timezone)

Note: those helpers don't accept a locale or an options object with a timezone.

date.toString()
// Sun Jun 12 2022 11:44:53 GMT+0200 (Central European Summer Time)

date.toDateString()
// Sun Jun 12 2022

date.toTimeString()
// 11:44:53 GMT+0200 (Central European Summer Time)

to UTC timezone ISO string

ISO8601 is an international standard. It indicates both the date component and the time component. It may provide the timezone.

birthDate.toISOString() // 2015-06-18T11:13:00.000Z
Date.parse("2015-06-18T11:13:00.000Z")

(optional) read calendar components

// the event occured on January 1st 2025, at 00:00 AM (Paris), device in China
birth.getFullYear() // 2025
birth.getMonth() // 0 (January)
birth.getDate() // 1 (for 1st)

birth.getHours() // 7
birth.getMinutes() // 0

// the UNIX Epoch instant
// Device in (Europe/Paris)
new Date(0).getHours() // 1