Modify

Opened 7 years ago

Closed 7 years ago

#2255 closed defect (fixed)

No bounds checking when adding/subtracting months

Reported by: anonymous Owned by: khundeen
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 7 years ago by khundeen

  • Status changed from new to assigned

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

comment:2 Changed 7 years ago by khundeen

  • Resolution set to fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.