Duration decimal calculation


#1

how to do duration in decimal format using duration unit “day”. (ex: 0.1 for 1 hour).


#2

Hi @mughi!
Unfortunately, the task duration can be in integer format (1 day, 3 hours, etc), fractional numbers are not supported.
As a workaround, you can change the internal duration units to hours and configure templates to show it in 0.5d format,
here is a small demo:
https://snippet.dhtmlx.com/7afafb1e9

You can also check our youtube videos for further details on the usage of grid templates

One challenge that is not done in this demo is user input - if you open the lightbox, you’ll see that the user have to enter the duration in hours, but not in 0.5d format.
So in order to achieve what you need, the following steps:

  1. implement a duration control for the lightbox that would allow entering duration in your format
    https://docs.dhtmlx.com/gantt/desktop__custom_editor.html

  2. and, if necessary, create an inline editor for this format.
    https://docs.dhtmlx.com/gantt/desktop__inline_editing.html#typesofeditors
    video: https://www.youtube.com/watch?v=0rIPrC0GtME

There is no ready solution for this but it looks doable. You can implement it yourself or we can develop it for you for an additional fee. Please ping me if you’re interested, or you can contact us via email at sales@dhtmlx.com


#3

Two fractions that are on the same denominator are called like fractions.

It is easy to add or subtract like fractions. check this link on how to solve it, also If we add like fractions we just add the numerators and this sum will be the new numerator while the denominator is stays the same.


#4

Hello Nona,
The dev team added the functionality to show decimal duration in the grid and the lightbox:
https://docs.dhtmlx.com/gantt/desktop__working_time.html#taskdurationindecimalformat
You don’t need to implement a custom solution unless you are using the standard version.