datopian / ckanext-versioning

Deprecated. See https://github.com/datopian/ckanext-versions. ⏰ CKAN extension providing data versioning (metadata and files) based on git and github.
https://tech.datopian.com/versioning/
GNU Affero General Public License v3.0
7 stars 4 forks source link

Templates are not rendering the version datetime correctly #28

Closed uwaheed88 closed 4 years ago

uwaheed88 commented 4 years ago

Issue :IVT-2717

pdelboca commented 4 years ago

It is not a good idea to split the time string each time we need to use it in the UI, what we should do is to update common.tag_to_dict logic, and modify how we create the created field ('created': tag.created.isoformat(),) so it can be directly used in CKAN's render_datetime helper.

Can you move the fix to tag_to_dict logic?

pdelboca commented 4 years ago

I have reviewed a little bit @uwaheed88 and this seems also like a buggy behaviour in CKAN due that helpers.render_datetime says it expects a ISO format string so I'm not sure why passing a date_time.isoformat() returns None. Maybe it is worth to explore a little bit what's happening.

uwaheed88 commented 4 years ago

@pdelboca in CKAN core helpers.py the render_datetime() is expecting an ISO format date but without the tzinfo. If there is the tzinfo present in the string this line returns a None value because this function _datestamp_to_datetime() generates an ValueError exception. due to this

Also, I found out that CKAN function _datestamp_to_datetime itself setting a timezone (UTC)

pdelboca commented 4 years ago

Okay! It's good to understand the context. Then move the logic to the common.tag_to_dict to return what CKAN expects.