Calendar components to Dates

A timezone is required to disambiguate (locate) the calendar components, get the UTC date and time, and compute the timestamp from it.

derive the JS Date from a timezone aware instance (Luxon):

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

const birthDate = zdt.toJSDate()

derive the JS Date from a timezone aware instance (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)

derive the JS date from an ISO string

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") // offset ISO, minutes granularity
new Date("2015-06-18T13:13:00+02:00") // offset ISO, seconds granularity
new Date("2015-06-18T11:13:00.000Z") // UTC ISO (Z)

from a date-only ISO string:

new Date("2015-06-18") // assumed to be UTC

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

The helpers assume the local timezone:

const birth = new Date(2015, 5 /* June */, 18, 13, 13)
new Date("2015-06-18T13:13:00")
earlymorning logo

© Antoine Weber 2026 - All rights reserved

Calendar components to Dates

A timezone is required to disambiguate (locate) the calendar components, get the UTC date and time, and compute the timestamp from it.

derive the JS Date from a timezone aware instance (Luxon):

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

const birthDate = zdt.toJSDate()

derive the JS Date from a timezone aware instance (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)

derive the JS date from an ISO string

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") // offset ISO, minutes granularity
new Date("2015-06-18T13:13:00+02:00") // offset ISO, seconds granularity
new Date("2015-06-18T11:13:00.000Z") // UTC ISO (Z)

from a date-only ISO string:

new Date("2015-06-18") // assumed to be UTC

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

The helpers assume the local timezone:

const birth = new Date(2015, 5 /* June */, 18, 13, 13)
new Date("2015-06-18T13:13:00")