Open maulik1729 opened 2 years ago
oh, you are right. Why didn't anybody notice this error before? Manipulating a Dayjs object created with a timezone will not adjust the offset.
We get the same (wrong) output, when using a setter
, e.g. dayjs("11-01-2022").tz("America/Boise", true).month(12)
.
As 'add' uses 'set' at the end of the method, I suppose this is the culprit. So we probably will need a 'set' method in the plugin 'timezone' that will call the original 'set' and then adjust the offset. Perhaps the existing 'startOf' method can be used as a template.
How about creating a pr for this? Momentarily I don't have the time for a pr.
dayjs("11-01-2022").tz("America/Boise", true).add(1, "month").toDate()
dayjs("12-01-2022").tz("America/Boise", true).toDate()
Expected: Should return same Value Current: Getting different values for both