[New Control] Duration

Hello Everyone,

A new control called Duration has been added to the Framework for saving time spans. Currently, it has been merged into the develop branch

duration

  • How is it stored in the database?

    The input is converted to seconds and stored in DB. The database field type is decimal. Using the formatters, the seconds are converted back to the duration format.

  • Options

    image

  • List View and Filters:

    list-view

  • Report View

    report-view

  • Print Preview

  • Web Form

    duration-web-form

PR:
https://github.com/frappe/frappe/pull/10248

11 Likes

This is a great feature!! Is this available in v12?

Nice! Is the display value localized? For example, in Germany I would expect to see “1 Tag 2 Std 10 Min 5 Sek”.

Edit: I discovered “no” and tried to fix it:
https://github.com/frappe/frappe/pull/10505

3 Likes

i noticed that you when you set the value of duration field to zero, it behaves strange? For eg:

Field A (duration) : 2m
Field B (duration) : 0m

Field C (duration) : Field A + Field B

TypeError: unsupported operand type(s) for +: ‘int’ and ‘str’


Field A (duration) : 2m
Field B (duration) : 2m

Field C (duration) : Field A + Field B (gets correct value 4m)

Any workaround for this please?

1 Like