Date format set to be correct utc date
As it turned out the format of the date used in Sahara may not be understood by som JavaScript engines which prevents the dates to be displayed correctly in UI. The milliseconds part of the time is also removed as it has never been necessary to access the dates with that accuracy. However the presence or sometime absence of the .ms suffix makes it harder to handle dates. Closes-Bug: #1443343 Change-Id: I1f4cc6dc443605ba632c1458bba8bd47a0e1a01f
This commit is contained in:
parent
882328204c
commit
3b4f17bc18
@ -42,6 +42,11 @@ class _SaharaBase(oslo_models.ModelBase, oslo_models.TimestampMixin):
|
||||
|
||||
def datetime_to_str(dct, attr_name):
|
||||
if dct.get(attr_name) is not None:
|
||||
dct[attr_name] = dct[attr_name].isoformat(' ')
|
||||
value = dct[attr_name].isoformat('T')
|
||||
ms_delimiter = value.find(".")
|
||||
if ms_delimiter != -1:
|
||||
# Removing ms from time
|
||||
value = value[:ms_delimiter]
|
||||
dct[attr_name] = value
|
||||
|
||||
SaharaBase = declarative.declarative_base(cls=_SaharaBase)
|
||||
|
Loading…
Reference in New Issue
Block a user