2014-08-25 17:02:13 |
Thai Tran |
bug |
|
|
added bug |
2014-08-25 17:02:38 |
Thai Tran |
horizon: assignee |
|
Thai Tran (tqtran) |
|
2014-08-25 17:08:57 |
Thai Tran |
summary |
Remove hard-coded date formats |
Replace hard-coded date formats with Django formats |
|
2014-08-25 17:22:51 |
Thai Tran |
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. |
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. It will also centralize the hard-coded date formats into a single place. |
|
2014-08-25 17:36:57 |
Thai Tran |
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. It will also centralize the hard-coded date formats into a single place. |
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" |
|
2014-08-25 17:40:49 |
OpenStack Infra |
horizon: status |
New |
In Progress |
|
2014-08-25 17:41:17 |
Thai Tran |
tags |
|
i18n |
|
2014-08-25 19:33:15 |
Doug Fish |
marked as duplicate |
|
1274144 |
|