Skip to content

Commit

Permalink
Issue while selecting previous month date from FEBRUARY. arqex#852
Browse files Browse the repository at this point in the history
  • Loading branch information
Manda committed Feb 13, 2023
1 parent e3bd533 commit fd2e592
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/DateTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
// 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 ) {
Expand Down

0 comments on commit fd2e592

Please sign in to comment.