Setting a time in Luxon and showing it in the user's local timezone

Viewed 5152

I'm using Luxon to show when orders will be processed. If they place an order after business hours 9am-5pm EST, I want to tell them their order will be ready at 2:00pm EST the following day.

    let easternTime = luxon.DateTime.local().setZone('America/New_York');
    let localTime = luxon.DateTime.local();
    // Omitted/Irrelevant Logic to determine if time is after 9am-5pm EST

    console.log("Business closed...turnaround next day");
    console.log(easternTime.toLocal().plus({ day: 1 }).toFormat('EEE, MMM d, 2:00 a ZZZZ'));

If someone see's this message in San Francisco (PST), I'd like the time to read 11:00am PST. How would I go about accomplishing this with Luxon or some other framework?

Thank you!

1 Answers

Just needed to use the .set({ hour: 14 }) functionality:

console.log(easternTime.set({ hour: 14 }).set({ minutes: 0 }).toLocal().plus({ day: 1 }).toFormat('EEE, MMM d, h:mm a ZZZZ'));
Related