I am working on one of my client issue. I have changed my system timezone to "(UTC-5:00) Eastern time (US & canada)". I wrote below code in my project -
new Date(year,month.date)
I observed that if month value is 0 or 1 ,then it is working fine -
new Date(2021,1,21)
Sun Feb 21 2021 00:00:00 GMT-0500 (Eastern Standard Time)
but if month value is greater than 1, then timezone is getting change by 1 hour-
new Date(2021,2,21)
Sun Mar 21 2021 00:00:00 GMT-0400 (Eastern Daylight Time)
which is causing problem. please someone suggest on this that why it is happening and what might be solution of this. expected answer should be in javascript or angular. moment library also will be accepted. this issue is only reproducible for few timezone. It is working fine for IST.