-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Activity timestamps are stored in local time instead of UTC #2882
Comments
That's not good. A fix would include a migration that updates the times in the db (using the current time offset should be close enough for the activity stream) and updating the templates to use the snippet that adjusts the display to the client's time zone |
@wardi and apparently "-1 days ago" is returned from here https://github.com/ckan/ckan/blob/master/ckan/lib/formatters.py#L71 if server time is in UTC but ckan.display_timezone is something else like Europe/Helsinki |
I confirm that activity timestamps are always stored in server local timezone guessing it is UTC. Given server timezone is |
According to this ticket the issue may be more than 4 years old: http://trac.ckan.org/ticket/331.html |
bcgov/ckanext-bcgov#147 ckan#2882 ckan#2970 The Activity model now stores its timestamp in utc In Formatters, localized_nice_date, removed the datetime replace method calls with actually ensuring the comparing timestamps have a timezone specified
bcgov/ckanext-bcgov#147 ckan#2882 ckan#2970 The Activity model now stores its timestamp in utc In Formatters, localized_nice_date, removed the datetime replace method calls with actually ensuring the comparing timestamps have a timezone specified fixing typo
bcgov/ckanext-bcgov#147 #2882 #2970 The Activity model now stores its timestamp in utc In Formatters, localized_nice_date, removed the datetime replace method calls with actually ensuring the comparing timestamps have a timezone specified fixing typo
bcgov/ckanext-bcgov#147 #2882 #2970 The Activity model now stores its timestamp in utc In Formatters, localized_nice_date, removed the datetime replace method calls with actually ensuring the comparing timestamps have a timezone specified fixing typo
https://github.com/ckan/ckan/blob/master/ckan/model/activity.py#L41
If server has local time set to some timezone that differs from UTC, activity streams show -1 days ago instead of just now, since datetime.now() return local time instead of UTC. There probably are others as well which use local time instead of UTC, at least based on a quick search https://github.com/ckan/ckan/search?utf8=%E2%9C%93&q=datetime.now%28%29&type=Code
The text was updated successfully, but these errors were encountered: