The subDay() Deluge function appears to produce erroneous results when back-traversing across a year boundary

The subDay() Deluge function appears to produce erroneous results when back-traversing across a year boundary

Hello,

I'm assuming that this bug will manifest in Deluge code across all of Zoho's product line, but since I don't know that for certain, I'm just posting about it in the Flow forum, since this mirrors the environment in which the problem was exposed.

There appears to be a bug in the subDay() function that causes it to fail and produce erroneous results when the number of subtracted days spans back into the previous calendar year.

As I write this, today's date is January 2nd,2023.

The following line should present a date that was three days ago, or December 30th, 2022:
  1. now.subDay(3).toString("YYYY-MM-DD 00:00");      

With applied formatting, the expected result would naturally be 2022-12-30 00:00 .

The result produced however is 2022-12-364 00:00 .

Unless this bug was introduced within the last year, I'd imagine this possibly that issue has been causing a rash of reporting issues right at the beginning of each year that were then possibly simply being dismissed. This is because by the time it was looked at by engineering (if it even got that far), the same problematic report(s) or custom functionality would appear to be magically "healed", and seem to be working fine again.  The issue was no longer reproducible, just so long as the result of the subDay() function didn't back-traverse into the prior year.

Thanks,
Bryan