Changeset 259 for trunk/common

Show
Ignore:
Timestamp:
02/06/08 05:04:04 (22 months ago)
Author:
ddavis
Message:

fix the calendar. If setting the month fails, its due to an invalid month and day, like Feb 31. I check if the month setting fails and use the last day of the month before re-setting it. BugzID: 67764

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/common/Calendar.js

    r159 r259  
    256256        } else 
    257257            m++; 
    258  
     258         
    259259        if ( this.disallowFuture ) { 
    260260            var dt = this.dateObject.clone(); 
     
    271271        } 
    272272         
    273         this.month( m ); 
    274273        this.year( y ); 
     274 
     275        /* if setting the month fails, reset the date to the last day of the month first */ 
     276        if ( this.month( m ) != m ) { 
     277            this.date( this.getDaysInMonth( m ) ); 
     278            this.month( m ); 
     279        } 
    275280 
    276281        return true; 
     
    288293            m--; 
    289294         
    290         this.month( m ); 
    291295        this.year( y ); 
     296         
     297        /* if setting the month fails, reset the date to the last day of the month first */ 
     298        if ( this.month( m ) != m ) { 
     299            this.date( this.getDaysInMonth( m ) ); 
     300            this.month( m ); 
     301        } 
    292302 
    293303        return true;