sql: fix serialization of dates with 2-digits years (#56205)
gitea-wip/wcs/pipeline/head Build started... Details
gitea/wcs/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Benjamin Dauvergne 2021-08-17 11:22:48 +02:00
parent 16a91507d4
commit e869dbb01c
1 changed files with 2 additions and 2 deletions

View File

@ -116,7 +116,7 @@ class Criteria(qommon.storage.Criteria):
def as_sql_param(self):
if isinstance(self.value, datetime.date):
value = self.value.strftime('%Y-%m-%d')
value = self.value.strftime('%4Y-%m-%d')
elif isinstance(self.value, time.struct_time):
value = datetime.datetime.fromtimestamp(time.mktime(self.value))
else:
@ -1750,7 +1750,7 @@ class SqlMixin:
for entry in value.get('data') or []:
subvalue = entry.get(field_id)
if subvalue and field_type == 'date':
entry[field_id] = strftime('%Y-%m-%d', subvalue)
entry[field_id] = strftime('%4Y-%m-%d', subvalue)
elif subvalue and field_type == 'file':
entry[field_id] = subvalue.__getstate__()
elif sql_type == 'boolean':