Open
Description
I was debugging a bug recently and realized that depending on how I create a moment I get different results. Apparently the logic used by the setters is different than the constructor arguments. This seems like a bug?
const timezone = 'Asia/Beirut';
const first = moment.tz([2020, 2, 29], timezone).toDate();
const second = moment.tz([1900, 0, 1], timezone).year(2020).month(2).date(29).toDate();
console.log('first', first); // first 2020-03-28T22:00:00.000Z
console.log('second', second); // second 2020-03-28T21:00:00.000Z
console.log('date of first', moment.tz(first, timezone).date()); // 29
console.log('date of first', moment.tz(second, timezone).date()); // 28
[email protected]
moment-timezone@^0.5.28
It is a bit hard to work around generically since the get methods are a much more forgiving when it comes to handling offsets/bubbling/rollover