This commit is contained in:
mikep%oeone.com 2002-07-22 12:42:34 +00:00
Родитель d698f88a32
Коммит f3964ae71d
1 изменённых файлов: 15 добавлений и 7 удалений

Просмотреть файл

@ -127,13 +127,6 @@ oeDatePicker.onpopupshowing = function( popup )
oeDatePicker.gOriginalDate = new Date( startDate );
oeDatePicker.gSelectedDate = new Date( startDate );
// Avoid problems when changing months if the date is at the end of the month
// i.e. if date is 31 march and you do a setmonth to april, the month would
// actually be set to may, beacause april only has 30 days.
// This is why we keep the original date around.
oeDatePicker.gSelectedDate.setDate( 1 );
// draw the year based on the selected date
oeDatePicker.redrawYear();
@ -227,6 +220,21 @@ oeDatePicker.clickMonth = function( newMonthItem, newMonthNumber )
{
return;
}
// Avoid problems when changing months if the date is at the end of the month
// i.e. if date is 31 march and you do a setmonth to april, the month would
// actually be set to may, beacause april only has 30 days.
// This is why we keep the original date around.
var oldDate = oeDatePicker.gSelectedDate.getDate();
var yearNumber = oeDatePicker.gSelectedDate.getFullYear();
var lastDayOfMonth = DateUtils.getLastDayOfMonth( yearNumber, newMonthNumber-1 );
if ( oldDate > lastDayOfMonth )
{
oeDatePicker.gSelectedDate.setDate(lastDayOfMonth);
}
// update the selected date