Calendar components to JS Date()

A timezone is required.

We talk about timezone aware helpers first.

from calendar components (Luxon):

const zdt = DateTime.fromObject(
    {
        year: 2015,
        month: 6,
        day: 18,
        hour: 13,
        minute: 13,
    },
    {
        zone: "Europe/Paris",
    }
)

const birthDate = zdt.toJSDate()

from calendar components (Temporal):

const zdt = Temporal.ZonedDateTime.from({
    year: 2015,
    month: 6,
    day: 18,
    hour: 13,
    minute: 13,
    timeZone: "Europe/Paris",
})

const birthDate = new Date(zdt.toInstant().epochMilliseconds)

with an offset ISO string (harder)

With an UTC offset in the date time string. This is worse than providing a timezone because it requires knowledge about the offset of the location at this date.

new Date(_iso_string_)

new Date("2015-06-18T13:13+02:00") // minute granularity
new Date("2015-06-18T13:13:00+02:00") // seconds granularity
new Date("2015-06-18T11:13:00.000Z") // zero offset, aka UTC

interpreted as midnight UTC.

new Date("2015-06-18") // no time and no timezone, interpreted as UTC 00:00

with local timezone date components (brittle) (do not use)

Note that in this helper, the birth date and time is inputed as the user remembers it, in the timezone he was born, and it will only work if it matches the device timezone. Instead, it should be better to specify the timezone explicitly.

const birth = new Date(2015, 5, 18, 13, 13) // June
// brittle

provide date time string with no offset.

new Date("2015-06-18T13:13:00") // no timezone, interpreted as in host timezone

with UTC components (do not use)

beware, the date-only ISO string assumes UTC, not the host timezone:

new Date("2021-01-01")
earlymorning logo

© Antoine Weber 2026 - All rights reserved

Calendar components to JS Date()

A timezone is required.

We talk about timezone aware helpers first.

from calendar components (Luxon):

const zdt = DateTime.fromObject(
    {
        year: 2015,
        month: 6,
        day: 18,
        hour: 13,
        minute: 13,
    },
    {
        zone: "Europe/Paris",
    }
)

const birthDate = zdt.toJSDate()

from calendar components (Temporal):

const zdt = Temporal.ZonedDateTime.from({
    year: 2015,
    month: 6,
    day: 18,
    hour: 13,
    minute: 13,
    timeZone: "Europe/Paris",
})

const birthDate = new Date(zdt.toInstant().epochMilliseconds)

with an offset ISO string (harder)

With an UTC offset in the date time string. This is worse than providing a timezone because it requires knowledge about the offset of the location at this date.

new Date(_iso_string_)

new Date("2015-06-18T13:13+02:00") // minute granularity
new Date("2015-06-18T13:13:00+02:00") // seconds granularity
new Date("2015-06-18T11:13:00.000Z") // zero offset, aka UTC

interpreted as midnight UTC.

new Date("2015-06-18") // no time and no timezone, interpreted as UTC 00:00

with local timezone date components (brittle) (do not use)

Note that in this helper, the birth date and time is inputed as the user remembers it, in the timezone he was born, and it will only work if it matches the device timezone. Instead, it should be better to specify the timezone explicitly.

const birth = new Date(2015, 5, 18, 13, 13) // June
// brittle

provide date time string with no offset.

new Date("2015-06-18T13:13:00") // no timezone, interpreted as in host timezone

with UTC components (do not use)

beware, the date-only ISO string assumes UTC, not the host timezone:

new Date("2021-01-01")