You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Clockify column Duration (decimal) is used to import the duration.
This leads to rounding errors in some constellations.
e.g. Start: 10:01; End: 10:42 = Duration 1:41h = 1.6833 in decimal.
After the import, the start/end is displayed correctly.
But the duration is displayed incorrectly as 1:40.
The duration is stored in the database as 6059 seconds.
The correct value would be 6060 seconds
It seems that the importer always rounds down.
When formatting from seconds to h:m, it rounds down again.
Therefore, one minute is displayed too little.
Solution for me:
Use the Clockify column Duration (h) when importing.
In file ImportBundle/Importer/ClockifyTimesheetImporter.php (Line ~112)
Swap the lines case 'Duration (h)': and case 'Duration (decimal)': with each other.
Can you try to switch your rounding rules in System > Preferences to 0 for all values and also change the rounding mode?
Kimai by default rounds minutes.
I have set all rounding rules to 0. Then made an import attempt for each rounding mode.
The problem remains with the wrong display of 1:40, instead of 1:41.
I have investigated the problem further:
When importing, the duration (decimal) is processed with the function Duration::parseDecimalFormat.
The duration is converted to seconds and then converted to int (round down).
As far as I have found, when displaying the duration in the Kimai timesheets, the function Duration::format is used to format the duration.
Here too, only rounding down is used.
The rounding rules from preferences are never used here.
I think the easiest way to solve the problem is to use the Clockify field duration (h) for the duration column.
This eliminates the rounding problems for me.
Here is a test file so that you can try it yourself.
Thanks for the detailed input. I could reproduce the issue and your fix is working.
And yes, I was previously wrong, the rounding rules are not applied during import (which would be wrong anyway).
Its fixed in the latest release of the plugin.
Describe the issue
Importer Version: 2.10.0
The Clockify column
Duration (decimal)
is used to import the duration.This leads to rounding errors in some constellations.
e.g. Start: 10:01; End: 10:42 = Duration 1:41h = 1.6833 in decimal.
After the import, the start/end is displayed correctly.
But the duration is displayed incorrectly as 1:40.
The duration is stored in the database as 6059 seconds.
The correct value would be 6060 seconds
It seems that the importer always rounds down.
When formatting from seconds to h:m, it rounds down again.
Therefore, one minute is displayed too little.
Solution for me:
Use the Clockify column
Duration (h)
when importing.In file ImportBundle/Importer/ClockifyTimesheetImporter.php (Line ~112)
Swap the lines
case 'Duration (h)':
andcase 'Duration (decimal)':
with each other.This will import the duration correctly.
I hope, this helps.
Or is there any better way?
I already tried
Kimai version
2.16.1
How do you run Kimai?
Virtual Server or alike
Which PHP version are you using?
8.2
Logfile
No response
Screenshots
No response
The text was updated successfully, but these errors were encountered: