@@ -1409,8 +1409,7 @@ $.extend( Datepicker.prototype, {
14091409 output += formatName ( "M" , date . getMonth ( ) , monthNamesShort , monthNames ) ;
14101410 break ;
14111411 case "y" :
1412- output += ( lookAhead ( "y" ) ? date . getFullYear ( ) :
1413- ( date . getFullYear ( ) % 100 < 10 ? "0" : "" ) + date . getFullYear ( ) % 100 ) ;
1412+ output += ( "0000" + date . getFullYear ( ) ) . slice ( lookAhead ( "y" ) ? - 4 : - 2 ) ;
14141413 break ;
14151414 case "@" :
14161415 output += date . getTime ( ) ;
@@ -2023,6 +2022,18 @@ $.extend( Datepicker.prototype, {
20232022 this . _daylightSavingAdjust ( new Date ( year , month , day ) ) ) :
20242023 this . _daylightSavingAdjust ( new Date ( inst . currentYear , inst . currentMonth , inst . currentDay ) ) ) ;
20252024 return this . formatDate ( this . _get ( inst , "dateFormat" ) , date , this . _getFormatConfig ( inst ) ) ;
2025+ } ,
2026+
2027+ /* Create a Date from a year, month, and day, accounting for years 0-99. */
2028+ _newDate : function ( year , month , day ) {
2029+ var date = new Date ( year , month , day ) ;
2030+
2031+ // Offset dates in the incorrect range. Blindly calling setFullYear(year) would not handle out-of-range
2032+ // months/days causing the year to shift.
2033+ if ( year >= 0 && year <= 99 ) {
2034+ date . setFullYear ( date . getFullYear ( ) - 1900 ) ;
2035+ }
2036+ return date ;
20262037 }
20272038} ) ;
20282039
0 commit comments