Edgewall Software

Changes between Initial Version and Version 1 of Ticket #10864, comment 4


Ignore:
Timestamp:
Oct 10, 2012, 2:54:48 PM (7 years ago)
Author:
Jun Omae

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #10864, comment 4

    initial v1  
    11Replying to [comment:3 cboos]:
    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 
    192> Also for `_parse_relative_time`, it's only used in `parse_date` which does call `to_datetime()` on the returned value of `_parse_relative_time`, so I think it's OK.
    203Sure. But we don't use the returned value of `to_datetime`....