Kimai2: duration input should be more flexible about values entered

Created on 13 May 2020  Â·  4Comments  Â·  Source: kevinpapst/kimai2

Is your feature request related to a problem? Please describe.
compared to an excel spreadsheet that tracks time durations, the following should work:

1:00 -> 01:00
1 -> 01:00
:30 -> 00:30

Describe the solution you'd like
don't make me type a leading 0 for no good reason

Describe alternatives you've considered
quick buttons for repeating values like 1hr meetings

Additional context
Add any other context or screenshots about the feature request here.

feature request

Most helpful comment

Idea: Maybe some simple JavaScript, that simply clarifies/calculates the correct duration format.

(Pseudocode!)

if (/^\s*(\d*)([.,](\d*))?\s*$/) {
    duration = sprintf(parsInt('0' + $1), '%2d') + ':' + sprintf(parsFloat('0.' + $2)*60, '%2d')
}

All 4 comments

Additionally I would like to input durations as decimals:
(consider dot and comma equally as decimal point for easy i8n)

1 ⇒ 01:00
1,5 ⇒ 01:30
1.5 ⇒ 01:30
0,5 ⇒ 00:30
5.25 ⇒ 05:15

and optionally without leading zero
,5 ⇒ 00:30

Idea: Maybe some simple JavaScript, that simply clarifies/calculates the correct duration format.

(Pseudocode!)

if (/^\s*(\d*)([.,](\d*))?\s*$/) {
    duration = sprintf(parsInt('0' + $1), '%2d') + ':' + sprintf(parsFloat('0.' + $2)*60, '%2d')
}

A lot of changes/improvements has been applied to the handling of the duration field, please see #2264

You can test it at https://demo-branch.kimai.org (eg. with susan_super and kitten).

Thank you very much. A great improvement in my opinion.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trentks picture trentks  Â·  5Comments

kevinpapst picture kevinpapst  Â·  6Comments

miketubby picture miketubby  Â·  6Comments

gitalexa picture gitalexa  Â·  3Comments

Sinister-lab picture Sinister-lab  Â·  3Comments