Replace day and month by 1 in date_trunk for SQLite
The value 0 is not valid for day and month. issue7263 review45311002
This commit is contained in:
@@ -91,11 +91,16 @@ def date_trunc(_type, date):
|
||||
break
|
||||
else:
|
||||
return None
|
||||
for attribute in [
|
||||
'microsecond', 'second', 'minute', 'hour', 'day', 'month', 'year']:
|
||||
for attribute, replace in [
|
||||
('microsecond', 0),
|
||||
('second', 0),
|
||||
('minute', 0),
|
||||
('hour', 0),
|
||||
('day', 1),
|
||||
('month', 1)]:
|
||||
if _type.startswith(attribute):
|
||||
break
|
||||
value = value.replace(**{attribute: 0})
|
||||
value = value.replace(**{attribute: replace})
|
||||
return str(value)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user