I want to construct a Date
object along with dynamically selected timezone. I am currently in IST time zone. I want to eliminate the usage of Date.parse()
as it does not behave as expected at times.
let's assume tzOffset
to be +05:30
for now. It could be any other timezone based on what users want. new Date(epochDate).toISOString();
converts the date to UTC timezone. How do I get the date in toISOString()
format but also get it in the desired time zone
const tsConstruct = `${year}-${month}-${date}T${hour}:${min}:00${tzOffset}`;
const epochDate = Date.parse(tsConstruct);
scheduledTs = new Date(epochDate).toISOString();