Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function date() doesn't return null for invalid dates #867

Closed
saig0 opened this issue Jun 17, 2024 · 3 comments · Fixed by #889
Closed

The function date() doesn't return null for invalid dates #867

saig0 opened this issue Jun 17, 2024 · 3 comments · Fixed by #889
Assignees
Labels
support relates to a support case type: bug

Comments

@saig0
Copy link
Member

saig0 commented Jun 17, 2024

Describe the bug
I can invoke the function date() with an invalid date, for example, "2023-02-29". I expected null but the function returns the last date of the month.

To Reproduce
Steps to reproduce the behavior:

  1. Evaluate the expression date("2023-02-29")
  2. Verify that the result is a date at "2023-02-28"

Expected behavior
The function date() returns null if the date is invalid.

To be consistent, we should also return null for date literals, date-time literals, and the date and time() function if the date is invalid.

Environment

@saig0 saig0 added type: bug support relates to a support case labels Jun 17, 2024
@saig0
Copy link
Member Author

saig0 commented Jun 17, 2024

⚠️ The expected behavior is not defined in the DMN 1.5 specification. And, there is no test case in the DMN TCK (ref).

@niekVandebron
Copy link

niekVandebron commented Jun 17, 2024

I was requested to provide a specific use case:

We don’t have a detailed use case other than parsing a date from a string coming from a request body (we do it in a few tasks).
But since we are new to feel/camunda we were experimenting with the date object and deciding if we wanted all of our date manipulations to happen within the APIs called via the REST connectors (in scala) or to keep them in the model (the easiest option).

Leap years are one of the first things you test when working with dates, so that's how we came across this issue.

But ultimately, if something has gone wrong where we have passed an invalid date to the model, we don’t want it to pick a magic date, we want it to be parsed as null so we know something is wrong somewhere

instead of possibly silently failing with the wrong date

@saig0
Copy link
Member Author

saig0 commented Jun 26, 2024

📥 I reported the issue to the OMG: https://issues.omg.org/browse/DMN17-67.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support relates to a support case type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants