1
0
Fork 0
mirror of https://github.com/topydo/topydo.git synced 2024-05-20 13:58:33 +00:00

Convert timestamp to float before using with arrow

arrow>=0.15.0 doesn't accept timestamps given as `str`. Unfortunately
`json` used in ChangeSet doesn't preserve `float` type in dictionary
keys and always converts it to `str`. This leaded to feeding `arrow`
with unsupported strings.

Read note at: https://docs.python.org/3/library/json.html#json.dumps for
further explanation.

This fixes #271 and #274
This commit is contained in:
Jacek Sowiński 2020-11-17 00:30:50 +01:00 committed by David Steele
parent 2c28d2196f
commit 37fcd38d61

View file

@ -98,7 +98,7 @@ class RevertCommand(Command):
num = 1
for timestamp, change in self._backup:
label = change[2]
time = arrow.get(timestamp).format('YYYY-MM-DD HH:mm:ss')
time = arrow.get(float(timestamp)).format('YYYY-MM-DD HH:mm:ss')
self.out('{0: >3}| {1} | {2}'.format(str(num), time, label))
num += 1