diff --git a/.babelrc b/.babelrc index 2d42f2173..c7f3a897f 100644 --- a/.babelrc +++ b/.babelrc @@ -2,8 +2,5 @@ "presets": [ "@babel/preset-react", "@babel/preset-env" - ], - "plugins": [ - "@babel/plugin-proposal-class-properties" ] } \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 5c5b7fded..1300681a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ sudo: false os: - linux node_js: - - '8' + - '12' - 'stable' script: - npm run lint diff --git a/package.json b/package.json index 958d6ad7d..208ddcb2c 100644 --- a/package.json +++ b/package.json @@ -41,32 +41,29 @@ "react": "^16.5.0" }, "devDependencies": { - "@babel/core": "7.7.4", - "@babel/plugin-proposal-class-properties": "^7.7.4", - "@babel/preset-env": "^7.7.7", - "@babel/preset-react": "^7.7.4", - "@svgr/webpack": "4.3.3", - "@testing-library/jest-dom": "^4.2.4", - "@testing-library/react": "^9.3.2", - "@testing-library/user-event": "^7.1.2", - "@types/react": "^16.5.0", + "@babel/core": "^7.14.3", + "@babel/preset-env": "^7.14.2", + "@babel/preset-react": "^7.13.13", + "@testing-library/jest-dom": "^5.11.6", + "@testing-library/react": "^11.2.2", + "@testing-library/user-event": "^12.6.0", + "@types/react": "^16.14.2", "@typescript-eslint/eslint-plugin": "^2.8.0", "@typescript-eslint/parser": "^2.8.0", "babel-eslint": "10.0.3", - "babel-jest": "^24.9.0", - "babel-loader": "8.0.6", "babel-plugin-named-asset-import": "^0.3.5", + "babel-loader": "8.2.2", "camelcase": "^5.3.1", "case-sensitive-paths-webpack-plugin": "2.2.0", "css-loader": "3.2.0", "dotenv": "8.2.0", "dotenv-expand": "5.1.0", - "enzyme": "^3.0.0", - "enzyme-adapter-react-16": "^1.15.2", "eslint": "^6.6.0", "eslint-config-react-app": "^5.1.0", "eslint-loader": "3.0.2", "eslint-plugin-flowtype": "3.13.0", + "enzyme": "^3.11.0", + "enzyme-adapter-react-16": "^1.15.5", "eslint-plugin-import": "2.18.2", "eslint-plugin-jsx-a11y": "6.2.3", "eslint-plugin-react": "7.16.0", @@ -75,11 +72,8 @@ "fs-extra": "^8.1.0", "html-webpack-plugin": "4.0.0-beta.5", "identity-obj-proxy": "3.0.0", - "jest": "24.9.0", - "jest-environment-jsdom-fourteen": "0.1.0", - "jest-resolve": "24.9.0", - "jest-watch-typeahead": "0.4.2", - "jsdom": "^7.0.2", + "jest": "^26.6.3", + "jest-watch-typeahead": "0.6.1", "mini-css-extract-plugin": "0.8.0", "moment": "^2.16.0", "moment-timezone": "^0.5.13", @@ -91,14 +85,14 @@ "postcss-preset-env": "6.7.0", "postcss-safe-parser": "4.0.1", "pre-commit": "^1.1.3", - "react": "^16.5.0", "react-app-polyfill": "^1.0.5", "react-dev-utils": "10.1.0", - "react-dom": "^16.5.0", + "react": "^16.14.0", + "react-dom": "^16.14.0", "react-onclickoutside": "^6.9.0", "react-test-renderer": "^16.5.0", "resolve": "1.12.2", - "resolve-url-loader": "3.1.1", + "resolve-url-loader": "3.1.2", "sass-loader": "8.0.0", "semver": "6.3.0", "style-loader": "1.0.0", @@ -138,7 +132,7 @@ "/test/**/__tests__/**/*.{js,jsx,ts,tsx}", "/test/**/*.{spec,test}.{js,jsx,ts,tsx}" ], - "testEnvironment": "jest-environment-jsdom-fourteen", + "testEnvironment": "jsdom", "transform": { "^.+\\.(js|jsx|ts|tsx)$": "/node_modules/babel-jest", "^.+\\.css$": "/config/jest/cssTransform.js", diff --git a/src/DateTime.js b/src/DateTime.js index 88a72bfb0..e9128b856 100644 --- a/src/DateTime.js +++ b/src/DateTime.js @@ -338,17 +338,18 @@ 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) + // Must first set month and year, then set day, + // 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 ) { update.selectedDate = viewDate.clone();