Workflow - Some Date calculations fail with certain formats #9902
Labels
Area: Workflow
Issues & PRs related to all things regarding workflow
Priority:Important
Issues & PRs that are important; broken functions, errors - there are workarounds
Status:Fix Proposed
A issue that has a PR related to it that provides a possible resolution
Type: Bug
Bugs within the core SuiteCRM codebase
When having a workflow action that runs on schedulers and calculates a date field using the date formulas provided https://docs.suitecrm.com/user/advanced-modules/workflow-calculated-fields/ , the results are wrong with certain combination of user date formats and values.
This can be reproduced if the user has the date format dd/mm/YYYY, and the day value is higher than 12, for example 15/12/2022. In this case, when applying the function
{datediff({P0}; {now(Y-m-d)} ; months )}
the DateTime function can't convert properly the "15/12/2022" date and it returns error.The issue is also replicable in "On save" Workflows if the date is hard-coded in the formula.
Issue
Date field calculation gives error with certain formats and values
Expected Behavior
It should work with any format and values.
Actual Behavior
The workflow fails and the date isn't calculated.
Possible Fix
Detect user format and convert to DB/UTC format in those cases that are needed.
Steps to Reproduce
birthdate
){datediff({P0}; {now(Y-m-d)} ; months )}
todescription
field)Context
This should work as expected
Your Environment
The text was updated successfully, but these errors were encountered: