Skip to content

Return duration in the biggest unit available #106

@barmac

Description

@barmac

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 #49

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions