I'm trying to create a date object like this:
const date = new Date('2021-08-02T08:10')
console.log(date, '---', date.toString())
//"2021-08-02T02:40:00.000Z" --- Mon Aug 02 2021 08:10:00 GMT+0530 (India Standard Time)
But this code will create date object which by default has the system timezone embedded to it.
What I want is some way to define a date object in such a way that I keep the date and time same as in the input string, but the timezone of the date object is different. Ex:
const date = new Date('2021-08-02T08:10', { timeZone: 'Asia/Jakarta' })
So that when I log the date object, it gives me data of that timezone
console.log(date.toString()); //Mon Aug 02 2021 08:10:00 GMT+0700 (Western Indonesia Time)