Skip to content

Commit

Permalink
[7.x] Update moment related packages (#46849) (#49517)
Browse files Browse the repository at this point in the history
* Update moment related packages

* unify moment version in yarn.lock

* adapt ro pluralization fixes

* update some bad pluralization in fixtures/snapshots
  • Loading branch information
Spencer authored Oct 28, 2019
1 parent d939a43 commit 07caa65
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 67 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@
"markdown-it": "^8.4.1",
"mini-css-extract-plugin": "0.8.0",
"minimatch": "^3.0.4",
"moment": "^2.20.1",
"moment-timezone": "^0.5.14",
"moment": "^2.24.0",
"moment-timezone": "^0.5.27",
"mustache": "2.3.2",
"ngreact": "0.5.1",
"node-fetch": "1.7.3",
Expand Down Expand Up @@ -316,7 +316,7 @@
"@types/markdown-it": "^0.0.7",
"@types/minimatch": "^2.0.29",
"@types/mocha": "^5.2.7",
"@types/moment-timezone": "^0.5.8",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/node": "^10.12.27",
"@types/opn": "^5.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/elastic-datemath/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"@babel/cli": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"babel-plugin-add-module-exports": "^1.0.2",
"moment": "^2.13.0"
"moment": "^2.24.0"
},
"dependencies": {
"tslib": "^1.9.3"
},
"peerDependencies": {
"moment": "^2.13.0"
"moment": "^2.24.0"
}
}
2 changes: 1 addition & 1 deletion packages/kbn-config-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"peerDependencies": {
"joi": "^13.5.2",
"moment": "^2.20.1",
"moment": "^2.24.0",
"type-detect": "^4.0.8"
}
}
2 changes: 1 addition & 1 deletion packages/kbn-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"execa": "^3.2.0",
"exit-hook": "^2.2.0",
"getopts": "^2.2.5",
"moment": "^2.20.1",
"moment": "^2.24.0",
"rxjs": "^6.2.1",
"tree-kill": "^1.2.1",
"tslib": "^1.9.3"
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-es-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"lodash": "npm:@elastic/[email protected]",
"moment-timezone": "^0.5.14",
"moment-timezone": "^0.5.27",
"@kbn/i18n": "1.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-framework/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"imports-loader": "^0.8.0",
"jquery": "^3.4.1",
"keymirror": "0.1.1",
"moment": "^2.20.1",
"moment": "^2.24.0",
"node-sass": "^4.9.4",
"postcss": "^7.0.5",
"postcss-loader": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ describe('formatTimestampToDuration', () => {
expect(formatTimestampToDuration(fiftyNineSeconds, CALCULATE_DURATION_SINCE, getTestTime())).to.be('59 seconds');

const fiveMins = getTestTime().subtract(5, 'minutes').subtract(30, 'seconds');
expect(formatTimestampToDuration(fiveMins, CALCULATE_DURATION_SINCE, getTestTime())).to.be('5 min');
expect(formatTimestampToDuration(fiveMins, CALCULATE_DURATION_SINCE, getTestTime())).to.be('6 mins');

const sixHours = getTestTime().subtract(6, 'hours').subtract(30, 'minutes');
expect(formatTimestampToDuration(sixHours, CALCULATE_DURATION_SINCE, getTestTime())).to.be('6 hrs 30 min');
expect(formatTimestampToDuration(sixHours, CALCULATE_DURATION_SINCE, getTestTime())).to.be('6 hrs 30 mins');

const sevenDays = getTestTime().subtract(7, 'days').subtract(6, 'hours').subtract(18, 'minutes');
expect(formatTimestampToDuration(sevenDays, CALCULATE_DURATION_SINCE, getTestTime())).to.be('7 days 6 hrs 18 min');
expect(formatTimestampToDuration(sevenDays, CALCULATE_DURATION_SINCE, getTestTime())).to.be('7 days 6 hrs 18 mins');

const eightWeeks = getTestTime().subtract(8, 'weeks').subtract(7, 'days').subtract(6, 'hours').subtract(18, 'minutes');
expect(formatTimestampToDuration(eightWeeks, CALCULATE_DURATION_SINCE, getTestTime())).to.be('2 months 2 days');

const oneHour = getTestTime().subtract(1, 'hour'); // should trim 0 min
expect(formatTimestampToDuration(oneHour, CALCULATE_DURATION_SINCE, getTestTime())).to.be('1 hrs');
expect(formatTimestampToDuration(oneHour, CALCULATE_DURATION_SINCE, getTestTime())).to.be('1 hr');

const oneDay = getTestTime().subtract(1, 'day'); // should trim 0 hrs
expect(formatTimestampToDuration(oneDay, CALCULATE_DURATION_SINCE, getTestTime())).to.be('1 days');
expect(formatTimestampToDuration(oneDay, CALCULATE_DURATION_SINCE, getTestTime())).to.be('1 day');

const twoMonths = getTestTime().subtract(2, 'month'); // should trim 0 days
expect(formatTimestampToDuration(twoMonths, CALCULATE_DURATION_SINCE, getTestTime())).to.be('2 months');
Expand All @@ -52,22 +52,22 @@ describe('formatTimestampToDuration', () => {
expect(formatTimestampToDuration(fiftyNineSeconds, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('59 seconds');

const fiveMins = getTestTime().add(10, 'minutes');
expect(formatTimestampToDuration(fiveMins, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('10 min');
expect(formatTimestampToDuration(fiveMins, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('10 mins');

const sixHours = getTestTime().add(6, 'hours').add(30, 'minutes');
expect(formatTimestampToDuration(sixHours, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('6 hrs 30 min');
expect(formatTimestampToDuration(sixHours, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('6 hrs 30 mins');

const sevenDays = getTestTime().add(7, 'days').add(6, 'hours').add(18, 'minutes');
expect(formatTimestampToDuration(sevenDays, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('7 days 6 hrs 18 min');
expect(formatTimestampToDuration(sevenDays, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('7 days 6 hrs 18 mins');

const eightWeeks = getTestTime().add(8, 'weeks').add(7, 'days').add(6, 'hours').add(18, 'minutes');
expect(formatTimestampToDuration(eightWeeks, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('2 months 2 days');

const oneHour = getTestTime().add(1, 'hour'); // should trim 0 min
expect(formatTimestampToDuration(oneHour, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('1 hrs');
expect(formatTimestampToDuration(oneHour, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('1 hr');

const oneDay = getTestTime().add(1, 'day'); // should trim 0 hrs
expect(formatTimestampToDuration(oneDay, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('1 days');
expect(formatTimestampToDuration(oneDay, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('1 day');

const twoMonths = getTestTime().add(2, 'month'); // should trim 0 days
expect(formatTimestampToDuration(twoMonths, CALCULATE_DURATION_UNTIL, getTestTime())).to.be('2 months');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function formatTimestampToDuration(timestamp, calculationFlag, initialTim
}

return duration
.replace(/ 0 min$/, '')
.replace(/ 0 mins$/, '')
.replace(/ 0 hrs$/, '')
.replace(/ 0 days$/, ''); // See https://github.com/jsmreese/moment-duration-format/issues/64
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@
"markdown-it": "^8.4.1",
"memoize-one": "^5.0.0",
"mime": "^2.4.4",
"moment": "^2.20.1",
"moment-duration-format": "^1.3.0",
"moment-timezone": "^0.5.14",
"moment": "^2.24.0",
"moment-duration-format": "^2.3.2",
"moment-timezone": "^0.5.27",
"monaco-editor": "~0.17.0",
"ngreact": "^0.5.1",
"nock": "10.0.6",
Expand Down Expand Up @@ -310,7 +310,7 @@
"react-dropzone": "^4.2.9",
"react-fast-compare": "^2.0.4",
"react-markdown": "^3.4.1",
"react-moment-proptypes": "^1.6.0",
"react-moment-proptypes": "^1.7.0",
"react-monaco-editor": "~0.27.0",
"react-portal": "^3.2.0",
"react-redux": "^5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/scripts/mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

require('../scripts/mocha');
require('../../scripts/mocha');
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"formattedLeader": "leader",
"metrics": {
"ccr_sync_lag_time": [{
"bucket_size": "10 min",
"bucket_size": "10 mins",
"timeRange": {
"min": 1537315200000,
"max": 1537401599000
Expand All @@ -22,7 +22,7 @@
"data": []
}],
"ccr_sync_lag_ops": [{
"bucket_size": "10 min",
"bucket_size": "10 mins",
"timeRange": {
"min": 1537315200000,
"max": 1537401599000
Expand Down
49 changes: 17 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3600,10 +3600,10 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.7.tgz#315d570ccb56c53452ff8638738df60726d5b6ea"
integrity sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==

"@types/moment-timezone@^0.5.8":
version "0.5.8"
resolved "https://registry.yarnpkg.com/@types/moment-timezone/-/moment-timezone-0.5.8.tgz#92aba9bc238cabf69a27a1a4f52e0ebb8f10f896"
integrity sha512-FpC+fLd/Hmxxcl4cxeb5HTyCmEvl3b4TeX8w9J+0frdzH+UCEkexKe4WZ3DTALwLj2/hyujn8tp3zl1YdgLrxQ==
"@types/moment-timezone@^0.5.12":
version "0.5.12"
resolved "https://registry.yarnpkg.com/@types/moment-timezone/-/moment-timezone-0.5.12.tgz#0fb680c03db194fe8ff4551eaeb1eec8d3d80e9f"
integrity sha512-hnHH2+Efg2vExr/dSz+IX860nSiyk9Sk4pJF2EmS11lRpMcNXeB4KBW5xcgw2QPsb9amTXdsVNEe5IoJXiT0uw==
dependencies:
moment ">=2.14.0"

Expand Down Expand Up @@ -19337,38 +19337,23 @@ module-not-found-error@^1.0.0:
resolved "https://registry.yarnpkg.com/module-not-found-error/-/module-not-found-error-1.0.1.tgz#cf8b4ff4f29640674d6cdd02b0e3bc523c2bbdc0"
integrity sha1-z4tP9PKWQGdNbN0CsOO8UjwrvcA=

moment-duration-format@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/moment-duration-format/-/moment-duration-format-1.3.0.tgz#541771b5f87a049cc65540475d3ad966737d6908"
integrity sha1-VBdxtfh6BJzGVUBHXTrZZnN9aQg=
moment-duration-format@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/moment-duration-format/-/moment-duration-format-2.3.2.tgz#5fa2b19b941b8d277122ff3f87a12895ec0d6212"
integrity sha512-cBMXjSW+fjOb4tyaVHuaVE/A5TqkukDWiOfxxAjY+PEqmmBQlLwn+8OzwPiG3brouXKY5Un4pBjAeB6UToXHaQ==

moment-timezone@^0.5.14:
version "0.5.14"
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.14.tgz#4eb38ff9538b80108ba467a458f3ed4268ccfcb1"
integrity sha1-TrOP+VOLgBCLpGekWPPtQmjM/LE=
moment-timezone@^0.5.27:
version "0.5.27"
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.27.tgz#73adec8139b6fe30452e78f210f27b1f346b8877"
integrity sha512-EIKQs7h5sAsjhPCqN6ggx6cEbs94GK050254TIJySD1bzoM5JTYDwAU1IoVOeTOL6Gm27kYJ51/uuvq1kIlrbw==
dependencies:
moment ">= 2.9.0"

[email protected], moment@>=1.6.0:
[email protected], "moment@>= 2.9.0", moment@>=1.6.0, moment@>=2.14.0, moment@^2.10.6, moment@^2.24.0:
version "2.24.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==

"moment@>= 2.9.0", moment@^2.13.0, moment@^2.20.1:
version "2.20.1"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.20.1.tgz#d6eb1a46cbcc14a2b2f9434112c1ff8907f313fd"
integrity sha512-Yh9y73JRljxW5QxN08Fner68eFLxM5ynNOAw2LbIB1YAGeQzZT8QFSUvkAz609Zf+IHhhaUxqZK8dG3W/+HEvg==

moment@>=2.14.0:
version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=

moment@^2.10.6:
version "2.21.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.21.0.tgz#2a114b51d2a6ec9e6d83cf803f838a878d8a023a"
integrity sha512-TCZ36BjURTeFTM/CwRcViQlfkMvL1/vFISuNLO5GkcVm1+QHfbSiNqZuWeMFjj1/3+uAjXswgRk30j1kkLYJBQ==

monaco-editor@~0.17.0:
version "0.17.1"
resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.17.1.tgz#8fbe96ca54bfa75262706e044f8f780e904aa45c"
Expand Down Expand Up @@ -22873,10 +22858,10 @@ react-markdown@^4.0.6:
unist-util-visit "^1.3.0"
xtend "^4.0.1"

react-moment-proptypes@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/react-moment-proptypes/-/react-moment-proptypes-1.6.0.tgz#8ec266ee392a08ba3412d2df2eebf833ab1046df"
integrity sha512-4h7EuhDMTzQqZ+02KUUO+AVA7PqhbD88yXB740nFpNDyDS/bj9jiPyn2rwr9sa8oDyaE1ByFN9+t5XPyPTmN6g==
react-moment-proptypes@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/react-moment-proptypes/-/react-moment-proptypes-1.7.0.tgz#89881479840a76c13574a86e3bb214c4ba564e7a"
integrity sha512-ZbOn/P4u469WEGAw5hgkS/E+g1YZqdves2BjYsLluJobzUZCtManhjHiZKjniBVT7MSHM6D/iKtRVzlXVv3ikA==
dependencies:
moment ">=1.6.0"

Expand Down

0 comments on commit 07caa65

Please sign in to comment.