Skip to content

Commit

Permalink
Merge pull request #1 from kmbn/meerbusch
Browse files Browse the repository at this point in the history
Render resource dates in same format as dataset dates
  • Loading branch information
kmbn authored May 2, 2017
2 parents e6df11f + f8bcdb7 commit c900752
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ckanext/scheming/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ def scheming_localize_date(date):
else:
div = '/'
if date[2] not in ['/', '.', '-']:
localized_date = date[8:]+div+date[5:7]+div+date[:4]
localized_date = date[8:10]+div+date[5:7]+div+date[:4]
else:
localized_date = date[:2]+div+date[3:5]+div+date[6:]
localized_date = date[:2]+div+date[3:5]+div+date[6:10]
return localized_date
else:
return ''
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ <h2>{{ _('Additional Information') }}</h2>
{%- block resource_last_updated -%}
<tr>
<th scope="row">{{ _('Last updated') }}</th>
<td>{{ h.render_datetime(res.last_modified) or h.render_datetime(res.revision_timestamp) or h.render_datetime(res.created) or _('unknown') }}</td>
<td>{{ h.scheming_localize_date(res.last_modified) or h.scheming_localize_date(res.revision_timestamp) or h.scheming_localize_date(res.created) or _('unknown') }}</td>
</tr>
{%- endblock -%}
{%- block resource_created -%}
<tr>
<th scope="row">{{ _('Created') }}</th>
<td>{{ h.render_datetime(res.created) or _('unknown') }}</td>
<td>{{ h.scheming_localize_date(res.created) or _('unknown') }}</td>
</tr>
{%- endblock -%}
{%- block resource_format -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,19 @@
<tr>
<th scope="row" class="dataset-label">{{
h.scheming_language_text(dates[n].role|capitalize) }}</th>
{% set date = h.scheming_localize_date(dates[n].date) %}
<td>{{ date }}</td>
<td>{{ h.scheming_localize_date(dates[n].date) }}</td>
</tr>
{% endfor %}
{% elif field.field_name == 'temporal_coverage' %}
{% set tcdates = h.scheming_convert_str_to_dict(pkg_dict.temporal_coverage) %}
{% if tcdates.temporal_coverage_from %}
<tr>
<th scope="row" class="dataset-label">{{ _('Zeitrahmen von') }}</th>
{% set date = h.scheming_localize_date(tcdates.temporal_coverage_from) %}
<td>{{ date }}</td>
<td>{{ h.scheming_localize_date(tcdates.temporal_coverage_from) }}</td>
</tr>
<tr>
<th scope="row" class="dataset-label">{{ _('Zeitrahmen bis') }}</th>
{% set date = h.scheming_localize_date(tcdates.temporal_coverage_to) %}
<td>{{ date }}</td>
<td>{{ h.scheming_localize_date(tcdates.temporal_coverage_to) }}</td>
</tr>
{% endif %}
{% else %}
Expand Down

0 comments on commit c900752

Please sign in to comment.