-
-
Notifications
You must be signed in to change notification settings - Fork 597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert timesheets to UTC with support for user timezone #372
Conversation
# Conflicts: # src/EventSubscriber/UserPreferenceSubscriber.php # tests/Controller/ProfileControllerTest.php
# Conflicts: # src/Controller/Admin/AboutController.php # src/EventSubscriber/UserPreferenceSubscriber.php
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
really happy that you've found a solution.
your changes solves my issue #507 and all previous imported data from kimai1 have correct time now.
converting entries i've created in kimai2 works fine too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there was one important part missing, which was added just now: |
If I checked out this branch and run
Do I have to restart something first (how?)? |
# Conflicts: # public/build/manifest.json # src/Entity/Timesheet.php # src/Twig/DateExtensions.php # templates/admin/timesheet.html.twig # templates/timesheet/index.html.twig # tests/Twig/DateExtensionsTest.php # var/data/kimai_test.sqlite
I'm sorry it took some time to answer. I did not convert anything, I started with an empty kimai. Checked out the timezone branch and tested. But I can see you did some work on this merged with master. So if the docker container is working again (after updating we encoutered lots of errors :(), we will test and come back to you. I'm sorry if that takes some time. |
So the docker container works again. We updated to the latest version. We did several things:
Whatever we do, when creating a new entry, start time is one hour early (UTC). Nothing changes when doing one of the changes above. When going to the calender view of this week, there is a red stripe on the current day / time. That stripe is really the current local time for me. The red stripe doesn't change place when changing to Amsterdam or UTC. So it looks like nothing is happening actually when changing the timezone. And then I am only looking at what happens when creating a new entry. However, it is great we can now start activities in the future, so it is not a problem if you change the time to +1 hour. Not how it should be ;). I created #554 for this. |
The calendar is not really interesting, that a javascript component using your computers local time (for the red stripe at least). The Kimai uses the system time and converts it to UTC before saving. When reading from the DB it will convert it back to the timezone, which was used while recording (this can either be the PHP timezone or the users timezone - if you configured one). Kimai does rely on the correct system time and correctly configured timezones. Sounds as if the docker container might be a source of your problem. Do you have a chance to test with the built-in PHP web server on your local machine (see dev installation docu)? |
Ok, lets discuss your topic in #554 |
Upon executing the command
I checked and the PDO extension is installed for PHP:
What else could be wrong? kr |
If Kimi works in the web, your PHP-Cli is missing the proper driver - as the exception says.
Having PDO alone is not enough, you need to activate the specific DB driver. |
I've got ubuntu 16.04 so I've added the following 2 lines in
but still pdo-mysql is not enabled. |
Afaik in Ubuntu you enable a PHP extension by linking its ini to /etc/php/7.2/cli/conf.d/. |
You're right, this is purely a PHP problem.
Thanks for your help and keep up the good work! wouter |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. If you use Kimai on a daily basis, please consider donating to support further development of Kimai. |
Fixes #336 , Fixes #507 , Fixes #511 , Fixes #531
Before this PR is/was merged Kimai stored datetimes in the local timezone. But this is a huge problem for various reasons (for technical backgrounds, please read this and this), so this PR changes the way how times are stored.
kimai.timesheet.rules.allow_future_times
to allow future records (default = true, regression bug from 0.7).Before you start two advices:
timesheet
table)This command can be safely executed if you did NOT import data from Kimai v1 before. This will convert ALL records in your database:
As Kimai 1 saved the times in another format, they were imported in UTC already, so they don't need conversion => they would be wrong if you convert them. So if you imported data from Kimai v1, you need to know the IDs that need to be converted. The command can take a start and an end ID.
Lets say you started with an import of 1000 records from Kimai 1, then the first ID that needs to be converted is 1001 which you append to the command like this:
If you want to convert the first 100 records, then skip the next 1000 and convert the rest, you need to execute two commands:
If you have question about the conversion, post a comment (even if the PR is closed already).
Sorry for the inconvience to everyone, this is why Kimai 2 is not yet released in a major version