@@ -1409,8 +1409,7 @@ $.extend( Datepicker.prototype, {
1409
1409
output += formatName ( "M" , date . getMonth ( ) , monthNamesShort , monthNames ) ;
1410
1410
break ;
1411
1411
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 ) ;
1414
1413
break ;
1415
1414
case "@" :
1416
1415
output += date . getTime ( ) ;
@@ -2023,6 +2022,18 @@ $.extend( Datepicker.prototype, {
2023
2022
this . _daylightSavingAdjust ( new Date ( year , month , day ) ) ) :
2024
2023
this . _daylightSavingAdjust ( new Date ( inst . currentYear , inst . currentMonth , inst . currentDay ) ) ) ;
2025
2024
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 ;
2026
2037
}
2027
2038
} ) ;
2028
2039
0 commit comments