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

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now