2 | | > Shouldn't the last line be more something like: |
3 | | > {{{ |
4 | | > default_due = to_datetime(default_due.replace(hours=18)) |
5 | | > }}} |
6 | | > i.e. have a normalize step after doing arithmetics with `timedelta` or like here, a `.replace()` (the latter should achieve the same effect, but more directly). |
7 | | |
8 | | Oh, I think it would be simple to call `to_datetime` at the end to localize and normalize. |
9 | | {{{#!python |
10 | | def _render_editor(self, req, db, milestone): |
11 | | # Suggest a default due time of 18:00 in the user's timezone |
12 | | now = datetime.now() |
13 | | default_due = now.replace(hour=18, minute=0, second=0, microsecond=0) |
14 | | if default_due <= now: |
15 | | default_due = default_due + timedelta(days=1) |
16 | | default_due = to_datetime(default_due, req.tz) |
17 | | }}} |
18 | | |