Adding time entries is broken at the end of month

Bug #1186330 reported by Ingo van Lil
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Eventum
Fix Released
Undecided
Elan Ruusamäe

Bug Description

There is a problem with adding new time entries at the end of the month, i.e. when the current day of month is above 28. Today I tried to create a time entry for last month, and the form would not let me select April in any of the date pickers. It would always change the field to May. Selecting any other month with less than 31 days was also not possible.

The problem is caused by the makeDate() function in htdocs/js/global.js: The code creates a new Date object (which automatically is set to the current date) and successively sets the year, month and day on this object. Calling setMonth() will result in an invalid date when the current day is 31 and the new month has less than 31 days.

Fixing the bug is trivial: Starting with JavaScript version 1.3 (i.e. since 1998 according to Wikipedia) the setMonth() call has an optional day parameter which sets month and day at the same time. See attached patch for details.

Revision history for this message
Ingo van Lil (ingo-vanlil) wrote :
Revision history for this message
Elan Ruusamäe (glen666) wrote :
Changed in eventum:
assignee: nobody → Elan Ruusamäe (glen666)
milestone: none → 2.3.4
status: New → Fix Committed
Elan Ruusamäe (glen666)
Changed in eventum:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.