I am building an browser-based application where the user sets the timezone of their application, e.g. "America/New_York". I have a part of the application that allows users to set reminders and I want the user to specify that they want, for example, to set a reminder for 28th Jan 2020 at 9am in their timezone. This should work such that it they are on holiday in London and used the application to set this reminder, displaying this reminder would still always be in the New York timezone. I store the dates as UTC in the applications database and when converting this back show the user will display it according to their timezone. I have tried this method in Codesandbox, to convert the date to UTC to store in the database:
const dateInNewYork = dayjs("2020-01-28 09:00:00", { timeZone: "America/New_York" }).toISOString();
// displays as 2020-03-29T11:00:00.000Z - shouldn't this be 2020-01-28T14:00:00.000Z ?
What am I doing wrong here?