conwetlab / ckanext-datarequests

A plugin that allows users to request data that is not published yet
GNU Affero General Public License v3.0
17 stars 54 forks source link

Data request display does not handle time zones properly #53

Open ThrawnCA opened 4 years ago

ThrawnCA commented 4 years ago

Data requests are displayed with inaccurate "Created" strings, eg "-1 days ago".

This appears to result from a lack of time zone handling. actions.py populates the creation timestamp without specifying a time zone, but when it is rendered, it uses a localisation method (formatters.localised_nice_date) that assumes a lack of time zone data means UTC.

Either the time zone should be specified when first creating the data request, or else the current server time zone (eg from helpers.get_display_timezone()) should be assumed when displaying it. The latter approach would also resolve existing data requests.

This is similar to https://github.com/ckan/ckanext-xloader/issues/102