Even the value I set for the time in the moment.js timezones same following two different approaches the value of the date returned is different
moment("02:00","HH:mm").tz('America/Chicago').format()
returns 2022-03-31T15:30:00-05:00
moment().tz('America/Chicago').set({hour:"02",minute:"00"})
returns 2022-04-01T02:00:02-05:00
Can anyone please help me in understanding why is it so?
console.log(moment("02:00","HH:mm").tz('America/Chicago').format());
console.log(moment().tz('America/Chicago').set({hour:"02",minute:"00"}).format());
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.34/moment-timezone-with-data-10-year-range.js"></script>