feelin icon indicating copy to clipboard operation
feelin copied to clipboard

Return duration in the biggest unit available

Open barmac opened this issue 1 year ago • 1 comments

Describe the Bug

Given I subtract one date from another, the result is always returned as the seconds in time duration format. I'd expect the days duration to be returned.

So duration("PD1") instead of duration("PT86400S") for date(today()) - date(today() - duration("P1D"))

Steps to Reproduce

https://nikku.github.io/feel-playground/?e=date%28today%28%29%29+-+date%28today%28%29+-+duration%28%22P1D%22%29%29&c=%7E3YCAkIC%2BgICAgICAgIC9AgCXnLILCNLEWVvD4A7RTE6e5VQHnL67RAf8ffGpOTFExGjxp2lIHt%2Fmy8diAzMQSsxIFwmdegBxI7oRrX98i6CA&t=expression&st=true

Expected Behavior

Return days, hours, minutes, seconds if possible.

Environment

  • Host (Browser/Node version), if applicable: [e.g. MS Edge 18, Chrome 69, Node 10 LTS]
  • OS: [e.g. Windows 7]
  • Library version: [e.g. 2.0.0]

Reported initially via https://camunda.slack.com/archives/C01QYD808A3/p1737037273702449


Related to https://github.com/nikku/feelin/issues/49

barmac avatar Jan 16 '25 14:01 barmac

Thanks, makes sense, though I don't think we should always return the "biggest" of the durations.

Potentially related to https://github.com/nikku/feelin/issues/49.

nikku avatar Jan 16 '25 15:01 nikku