fix serialization

This commit is contained in:
Lendemor 2024-11-22 17:14:49 +01:00
parent 5ff5dc3415
commit 8a6d3ae44c

View File

@ -211,7 +211,8 @@ class LiteralDatetimeVar(LiteralVar, DateTimeVar):
LiteralDatetimeVar: The new instance of the class.
"""
if isinstance(value, datetime):
js_expr = f"new Date({value.year}, {value.month - 1}, {value.day}, {value.hour}, {value.minute}, {value.second}, {value.microsecond})"
js_expr = f"'{value.year}-{value.month - 1}-{value.day} {value.hour}:{value.minute}:{value.second}, {value.microsecond})"
js_expr = f'"{str(value)}"'
elif isinstance(value, date):
js_expr = f"new Date({value.year}, {value.month - 1}, {value.day})"
return cls(