Closed fwc closed 3 years ago
for reproducing, set date_format
in the configuration to date_format = "%d.%m."
.
The initial date (2021-04-21
) is then displayed in this format ("21.04."
), and 'parsed back' into a datetime-object when saving, but the year is lost during the process.
When re-parsing the date, we run into the following code in interactive.py
:
def _save_inner(self):
# ...
self.todo.due = self.formatter.parse_datetime(self.due)
# ...
self.todo.due
is still the initial datetime.date
-object (2021-04-21
).self.due
is the string value that was displayed, which in turn is the formatted date
-object: "21.04."
.self.due
matches the date_format
, so it's parsed with datetime.strptime
, which sets the year to 1900:
>>> datetime.strptime("21.04.", "%d.%m.")
# returns: datetime.datetime(1900, 4, 21, 0, 0)
I have a todo with due date 21.04, specified as
DUE;VALUE=DATE:20210421
in the.ics
-file.When I open this todo with
todo edit <id>
and save it again directly, without changes, the due date is changed toDUE;VALUE=DATE-TIME:19000420T230000Z
.So my todo is now due on 21.04.1900.
.ics
-file before editing with todoman.ics
-file after editing with todoman