Modify

Opened 9 years ago

Closed 9 years ago

#2255 closed defect (fixed)

No bounds checking when adding/subtracting months

Reported by: anonymous Owned by: Bhuricha Deen Sethanandha
Priority: high Component: TracMetrixPlugin
Severity: major Keywords: datetime last_day_of_month
Cc: Trac Release: 0.11

Description

There are several locations in web_ui.py where a month is passed into datetime as a parameter. Many instances pass in month+1 or month-1. These calls fail when month is December and January, since Dec = 12 and 12 +1 = 13 and since Jan = 1 and 1-1 = 0. datetime requires that the month be between 1 and 12. It is probably better when performing math on months to use a datetime object for the current month and then add/subtract timedelta(months=1). Then access the month attribute of the resulting datetime object. An example of the error can be found in the last_day_of_month method.

Attachments (0)

Change History (2)

comment:1 Changed 9 years ago by Bhuricha Deen Sethanandha

Status: newassigned

Thank for your very good advice. I will take care of this right away.

comment:2 Changed 9 years ago by Bhuricha Deen Sethanandha

Resolution: fixed
Status: assignedclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Bhuricha Deen Sethanandha.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.