changeset 662ae82c0f5e in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=662ae82c0f5e
description:
PYSON's DateTime defaults to the current time in UTC
issue9698
review329211002
diffstat:
doc/ref/pyson.rst | 4 +++-
trytond/pyson.py | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r b307bd41f89d -r 662ae82c0f5e doc/ref/pyson.rst
--- a/doc/ref/pyson.rst Wed Oct 21 23:27:13 2020 +0200
+++ b/doc/ref/pyson.rst Thu Oct 22 12:11:09 2020 +0200
@@ -218,10 +218,12 @@
the *arguments* explained below.
Missing values of arguments named by ``year``, ``month``, ``day``, ``hour``,
``minute``, ``second``, ``microseconds`` take their defaults from ``start`` or
-the actual date and time.
+the actual date and time in `UTC`_.
When values of arguments named by ``delta_*`` are given, these are added to
the appropriate attributes in a date and time preserving manner.
+.. _`UTC`: https://en.wikipedia.org/wiki/Coordinated_Universal_Time
+
Arguments:
``year``
diff -r b307bd41f89d -r 662ae82c0f5e trytond/pyson.py
--- a/trytond/pyson.py Wed Oct 21 23:27:13 2020 +0200
+++ b/trytond/pyson.py Thu Oct 22 12:11:09 2020 +0200
@@ -644,7 +644,7 @@
and not isinstance(now, datetime.datetime)):
now = datetime.datetime.combine(now, datetime.time())
if not isinstance(now, datetime.datetime):
- now = datetime.datetime.now()
+ now = datetime.datetime.utcnow()
return now + relativedelta(
year=dct['y'],
month=dct['M'],