diff --git a/src/DateTime.js b/src/DateTime.js index 6b2e8aebb..0840135a4 100644 --- a/src/DateTime.js +++ b/src/DateTime.js @@ -338,16 +338,15 @@ export default class Datetime extends React.Component { let updateOnView = this.getUpdateOn( this.getFormat('date') ); let viewDate = this.state.viewDate.clone(); - // Set the value into day/month/year - viewDate[ this.viewToMethod[currentView] ]( - parseInt( e.target.getAttribute('data-value'), 10 ) - ); - // Need to set month and year will for days view (prev/next month) if ( currentView === 'days' ) { - viewDate.month( parseInt( e.target.getAttribute('data-month'), 10 ) ); viewDate.year( parseInt( e.target.getAttribute('data-year'), 10 ) ); + viewDate.month( parseInt( e.target.getAttribute('data-month'), 10 ) ); } + // Set the value into day/month/year + viewDate[ this.viewToMethod[currentView] ]( + parseInt( e.target.getAttribute('data-value'), 10 ) + ); let update = {viewDate: viewDate}; if ( currentView === updateOnView ) {