From b2e22e69e1c92577f82325431eedaafd4bd024b9 Mon Sep 17 00:00:00 2001 From: menghu07 <812877318@qq.com> Date: Sat, 29 May 2021 08:49:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?'=E5=85=88=E8=AE=BE=E7=BD=AE4=E6=9C=881?= =?UTF-8?q?=E6=97=A5=EF=BC=8C=E5=9C=A8=E8=AE=BE=E7=BD=AE5=E6=9C=8831?= =?UTF-8?q?=E6=97=A5'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/DateTime.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/DateTime.js b/src/DateTime.js index 88a72bfb0..33b739617 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(); From c611c449d74e0ebdead1e09949c7d3eaf609cc1b Mon Sep 17 00:00:00 2001 From: menghu07 <812877318@qq.com> Date: Sat, 29 May 2021 16:34:33 +0800 Subject: [PATCH 2/4] tabs2 or 3 --- src/DateTime.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DateTime.js b/src/DateTime.js index 33b739617..e9128b856 100644 --- a/src/DateTime.js +++ b/src/DateTime.js @@ -345,10 +345,10 @@ export default class Datetime extends React.Component { 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 ) - ); + // 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 ) { From f2173f77e3ebd075e87c4bb93cc35552bad30dca Mon Sep 17 00:00:00 2001 From: menghu07 <812877318@qq.com> Date: Sat, 29 May 2021 18:26:27 +0800 Subject: [PATCH 3/4] update babel test --- .babelrc | 5 +---- .travis.yml | 2 +- package.json | 38 ++++++++++++++++---------------------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/.babelrc b/.babelrc index 2d42f2173..8e3d92ac2 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", From 781b1af90fc1ebf0830f26073f1de723aee0a30c Mon Sep 17 00:00:00 2001 From: menghu07 <812877318@qq.com> Date: Sat, 29 May 2021 19:14:57 +0800 Subject: [PATCH 4/4] br --- .babelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.babelrc b/.babelrc index 8e3d92ac2..c7f3a897f 100644 --- a/.babelrc +++ b/.babelrc @@ -3,4 +3,4 @@ "@babel/preset-react", "@babel/preset-env" ] -} +} \ No newline at end of file