Replace hard-coded date formats with Django formats

Bug #1361305 reported by Thai Tran
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
In Progress
Undecided
Thai Tran

Bug Description

We are currently using hard coded date formats in various D3 charts. We have things like "%Y-%m-%dT%H:%M:%S" scattered throughout the code. We should really be using Django's date format. Here are a few of the formats available:

 django.formats = {
    "DATETIME_FORMAT": "N j, Y, P",
    "DATETIME_INPUT_FORMATS": [
      "%Y-%m-%d %H:%M:%S",
      "%Y-%m-%d %H:%M:%S.%f",
      "%Y-%m-%d %H:%M",
      "%Y-%m-%d",
      "%m/%d/%Y %H:%M:%S",
      "%m/%d/%Y %H:%M:%S.%f",
      "%m/%d/%Y %H:%M",
      "%m/%d/%Y",
      "%m/%d/%y %H:%M:%S",
      "%m/%d/%y %H:%M:%S.%f",
      "%m/%d/%y %H:%M",
      "%m/%d/%y"
    ]

As you can see, the hard-coded format is very similar to django.formats.DATE_TIME_INPUT_FORMATS[0]. Why do we wan to do this? Django handles internationalization for us, so it make sense to take advantage of this.

People in different locale read dates differently. For example,
In english: "%Y-%m-%d %H:%M:%S"
In spanish: "%d/%m/%Y %H:%M:%S"

Tags: i18n
Thai Tran (tqtran)
Changed in horizon:
assignee: nobody → Thai Tran (tqtran)
Thai Tran (tqtran)
summary: - Remove hard-coded date formats
+ Replace hard-coded date formats with Django formats
Thai Tran (tqtran)
description: updated
Thai Tran (tqtran)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/116686

Changed in horizon:
status: New → In Progress
Thai Tran (tqtran)
tags: added: i18n
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Thai Tran (<email address hidden>) on branch: master
Review: https://review.openstack.org/116686

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.