@@ -213,18 +213,18 @@ export default class Calendar extends React.Component {
213213
214214 increaseMonth = ( ) => {
215215 this . setState (
216- {
217- date : addMonths ( this . state . date , 1 )
218- } ,
216+ ( { date } ) => ( {
217+ date : addMonths ( date , 1 )
218+ } ) ,
219219 ( ) => this . handleMonthChange ( this . state . date )
220220 ) ;
221221 } ;
222222
223223 decreaseMonth = ( ) => {
224224 this . setState (
225- {
226- date : subMonths ( this . state . date , 1 )
227- } ,
225+ ( { date } ) => ( {
226+ date : subMonths ( date , 1 )
227+ } ) ,
228228 ( ) => this . handleMonthChange ( this . state . date )
229229 ) ;
230230 } ;
@@ -269,30 +269,27 @@ export default class Calendar extends React.Component {
269269
270270 changeYear = year => {
271271 this . setState (
272- {
273- date : setYear ( this . state . date , year )
274- } ,
272+ ( { date } ) => ( {
273+ date : setYear ( date , year )
274+ } ) ,
275275 ( ) => this . handleYearChange ( this . state . date )
276276 ) ;
277277 } ;
278278
279279 changeMonth = month => {
280280 this . setState (
281- {
282- date : setMonth ( this . state . date , month )
283- } ,
281+ ( { date } ) => ( {
282+ date : setMonth ( date , month )
283+ } ) ,
284284 ( ) => this . handleMonthChange ( this . state . date )
285285 ) ;
286286 } ;
287287
288288 changeMonthYear = monthYear => {
289289 this . setState (
290- {
291- date : setYear (
292- setMonth ( this . state . date , getMonth ( monthYear ) ) ,
293- getYear ( monthYear )
294- )
295- } ,
290+ ( { date } ) => ( {
291+ date : setYear ( setMonth ( date , getMonth ( monthYear ) ) , getYear ( monthYear ) )
292+ } ) ,
296293 ( ) => this . handleMonthYearChange ( this . state . date )
297294 ) ;
298295 } ;
@@ -331,9 +328,9 @@ export default class Calendar extends React.Component {
331328
332329 decreaseYear = ( ) => {
333330 this . setState (
334- {
335- date : subYears ( this . state . date , 1 )
336- } ,
331+ ( { date } ) => ( {
332+ date : subYears ( date , 1 )
333+ } ) ,
337334 ( ) => this . handleYearChange ( this . state . date )
338335 ) ;
339336 } ;
@@ -537,9 +534,7 @@ export default class Calendar extends React.Component {
537534 < div className = "react-datepicker__header" >
538535 { this . renderCurrentMonth ( monthDate ) }
539536 < div
540- className = { `react-datepicker__header__dropdown react-datepicker__header__dropdown--${
541- this . props . dropdownMode
542- } `}
537+ className = { `react-datepicker__header__dropdown react-datepicker__header__dropdown--${ this . props . dropdownMode } ` }
543538 onFocus = { this . handleDropdownFocus }
544539 >
545540 { this . renderMonthDropdown ( i !== 0 ) }
0 commit comments