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

Adding time to duration doesn't create the same result as adding duration to time #56

Open
par-shd opened this issue Jan 23, 2024 · 1 comment
Labels
bug Something isn't working pr welcome ready tck

Comments

@par-shd
Copy link

par-shd commented Jan 23, 2024

Describe the Bug

Addition of time and duration types should create a time type (See Camunda docs). If the first and second argument of addition are time and duration types, the result is as expected. But if the first and second argument of addition are duration and time (the reverse order of the previous situation), the result becomes a number.

Steps to Reproduce

See playground

Expected Behavior

If the first and second argument of addition are duration and time, the result should be a time.

@par-shd par-shd added the bug Something isn't working label Jan 23, 2024
@nikku nikku added the tck label Jan 24, 2024
@nikku
Copy link
Owner

nikku commented Jan 24, 2024

Thanks for the report. The following should be all true:

[
  date("2020-04-06") + duration("P1D") = date("2020-04-07"),
  duration("P1D") + date("2020-04-06") = date("2020-04-07"),
  time("08:00:00") + duration("PT1H") = time("09:00:00"),
  duration("PT1H") + time("08:00:00") = time("09:00:00"),
  date and time("2020-04-06T08:00:00") + duration("P7D") = date and time("2020-04-13T08:00:00"),
  duration("P7D") + date and time("2020-04-06T08:00:00") = date and time("2020-04-13T08:00:00"),
  duration("P2D") + duration("P5D") = duration("P7D")
]

It seems like we don't handle duration + date/time appropriately. Happy to take a contribution that improves this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pr welcome ready tck
Projects
None yet
Development

No branches or pull requests

2 participants