Commit 28f20e28 authored by Simon Knox's avatar Simon Knox

Merge branch '225290-time-tooltips-incorrectly-display-time-zones' into 'master'

Resolve "Time tooltips incorrectly display time zones"

See merge request gitlab-org/gitlab!70723
parents 9c0bc23b 5451d41c
......@@ -26,7 +26,17 @@ const isValidDateString = (dateString) => {
return false;
}
return !Number.isNaN(Date.parse(dateformat(dateString, 'isoUtcDateTime')));
let isoFormatted;
try {
isoFormatted = dateformat(dateString, 'isoUtcDateTime');
} catch (e) {
if (e instanceof TypeError) {
// not a valid date string
return false;
}
throw e;
}
return !Number.isNaN(Date.parse(isoFormatted));
};
const handleRangeDirection = ({ direction = DEFAULT_DIRECTION, anchorDate, minDate, maxDate }) => {
......
......@@ -122,7 +122,7 @@ module.exports = (path, options = {}) => {
'^.+\\.(md|zip|png)$': 'jest-raw-loader',
},
transformIgnorePatterns: [
'node_modules/(?!(@gitlab/ui|@gitlab/favicon-overlay|bootstrap-vue|three|monaco-editor|monaco-yaml|fast-mersenne-twister|prosemirror-markdown)/)',
'node_modules/(?!(@gitlab/ui|@gitlab/favicon-overlay|bootstrap-vue|three|monaco-editor|monaco-yaml|fast-mersenne-twister|prosemirror-markdown|dateformat)/)',
],
timers: 'fake',
testEnvironment: '<rootDir>/spec/frontend/environment.js',
......
......@@ -4333,10 +4333,10 @@ date-now@^0.1.4:
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=
dateformat@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c"
integrity sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==
dateformat@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-5.0.1.tgz#60a27a2deb339f888ba4532f533e25ac73ca3d19"
integrity sha512-DrcKxOW2am3mtqoJwBTK3OlWcF0QSk1p8diEWwpu3Mf//VdURD7XVaeOV738JvcaBiFfm9o2fisoMhiJH0aYxg==
de-indent@^1.0.2:
version "1.0.2"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment