yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #19495
[Bug 1361305] [NEW] Replace hard-coded date formats with Django formats
Public bug reported:
We are currently using hard coded date formats in various D3 charts. We
should 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. It will also centralize the hard-coded date formats
into a single place.
** Affects: horizon
Importance: Undecided
Assignee: Thai Tran (tqtran)
Status: New
** Changed in: horizon
Assignee: (unassigned) => Thai Tran (tqtran)
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1361305
Title:
Replace hard-coded date formats with Django formats
Status in OpenStack Dashboard (Horizon):
New
Bug description:
We are currently using hard coded date formats in various D3 charts.
We should 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. It will also centralize the hard-coded date formats
into a single place.
To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1361305/+subscriptions
Follow ups
References