Opened 4 years ago

Last modified 19 months ago

#11656 new defect

Datetime calculation breaks calendar at last day(s)-of-month

Reported by: Steffen Hoffmann Owned by:
Priority: normal Component: WikiCalendarMacro
Severity: normal Keywords: calendar calculation out-of-range
Cc: Ryan J Ollos Trac Release: 0.11


Today, 31-Mar-2014, some colleagues of mine reported a broken wiki calendar:

2014-03-31 09:41:52,378 Trac[formatter] ERROR: Macro WikiTicketCalendar(None) failed: 
Traceback (most recent call last):
  File "/local/lib/python2.7/site-packages/Trac-1.1.1dev_r11359-py2.7.egg/trac/wiki/", line 765, in _macro_formatter
    return macro.ensure_inline(macro.process(args))
  File "/local/lib/python2.7/site-packages/Trac-1.1.1dev_r11359-py2.7.egg/trac/wiki/", line 356, in process
    text = self.processor(text)
  File "/local/lib/python2.7/site-packages/Trac-1.1.1dev_r11359-py2.7.egg/trac/wiki/", line 343, in _macro_processor
  File "build/bdist.linux-i686/egg/wikicalendar/", line 402, in expand_macro
    today = now.replace(month=month)
ValueError: day is out of range for month

In general it happens, when you jump to months with less days then your current day-of-month. February is broken at any 30. and 31. of all other months, and in most years even on each 29th day-of-month.

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by Steffen Hoffmann

In 13798:

WikiCalendarMacro: Improve 'today' offset calculation to succeed for any day-of-month, refs #11656.

comment:2 Changed 19 months ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.