mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Upgrading the datemath.parse syntax to version 4.0 (#15999)
* Upgrading the datemath.parse syntax to version 4.0 * [@elastic/datemath] bump to version 4 * Updating yarn.lock for datemath-js@4.0 * Updating to dateamath-js@4.0.1
This commit is contained in:
parent
ac63d371b5
commit
b6537e67c7
6 changed files with 12 additions and 13 deletions
|
@ -74,7 +74,7 @@
|
|||
"url": "https://github.com/elastic/kibana.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elastic/datemath": "2.3.0",
|
||||
"@elastic/datemath": "4.0.1",
|
||||
"@elastic/eui": "0.0.13",
|
||||
"@elastic/filesaver": "1.1.2",
|
||||
"@elastic/numeral": "2.3.1",
|
||||
|
|
|
@ -581,7 +581,7 @@ function discoverController(
|
|||
$scope.updateTime = function () {
|
||||
$scope.timeRange = {
|
||||
from: dateMath.parse(timefilter.time.from),
|
||||
to: dateMath.parse(timefilter.time.to, true)
|
||||
to: dateMath.parse(timefilter.time.to, { roundUp: true })
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ module.directive('prettyDuration', function (config, timeUnits) {
|
|||
if ($scope[time] === 'now') {
|
||||
display[time] = 'now';
|
||||
} else {
|
||||
const tryParse = dateMath.parse($scope[time], time === 'to' ? true : false);
|
||||
const tryParse = dateMath.parse($scope[time], { roundUp: time === 'to' });
|
||||
display[time] = moment.isMoment(tryParse) ? '~ ' + tryParse.fromNow() : $scope[time];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ uiModules
|
|||
Timefilter.prototype.getBounds = function () {
|
||||
return {
|
||||
min: dateMath.parse(this.time.from),
|
||||
max: dateMath.parse(this.time.to, true)
|
||||
max: dateMath.parse(this.time.to, { roundUp: true })
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ module.directive('kbnTimepicker', function (timeUnits, refreshIntervals) {
|
|||
break;
|
||||
case 'absolute':
|
||||
$scope.absolute.from = dateMath.parse($scope.from || moment().subtract(15, 'minutes'));
|
||||
$scope.absolute.to = dateMath.parse($scope.to || moment(), true);
|
||||
$scope.absolute.to = dateMath.parse($scope.to || moment(), { roundUp: true });
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ module.directive('kbnTimepicker', function (timeUnits, refreshIntervals) {
|
|||
$scope.checkRelative = function () {
|
||||
if ($scope.relative.from.count != null && $scope.relative.to.count != null) {
|
||||
const from = dateMath.parse(getRelativeString('from'));
|
||||
const to = dateMath.parse(getRelativeString('to'), true);
|
||||
const to = dateMath.parse(getRelativeString('to'), { roundUp: true });
|
||||
if (to && from) return to.isBefore(from);
|
||||
return true;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ module.directive('kbnTimepicker', function (timeUnits, refreshIntervals) {
|
|||
|
||||
$scope.formatRelative = function (key) {
|
||||
const relativeString = getRelativeString(key);
|
||||
const parsed = dateMath.parse(relativeString, key === 'to');
|
||||
const parsed = dateMath.parse(relativeString, { roundUp: key === 'to' });
|
||||
let preview;
|
||||
if (relativeString === 'now') {
|
||||
preview = 'Now';
|
||||
|
|
11
yarn.lock
11
yarn.lock
|
@ -63,12 +63,11 @@
|
|||
lodash "^4.2.0"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@elastic/datemath@2.3.0":
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@elastic/datemath/-/datemath-2.3.0.tgz#d540cc7660f0b7a1e50277a7af3a2fef18297ef7"
|
||||
"@elastic/datemath@4.0.1":
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@elastic/datemath/-/datemath-4.0.1.tgz#d0d50d675f42a881912e1d5ca84bda493bb7e92d"
|
||||
dependencies:
|
||||
lodash "~3.10.1"
|
||||
moment "~2.13.0"
|
||||
moment "^2.13.0"
|
||||
|
||||
"@elastic/eslint-config-kibana@0.15.0":
|
||||
version "0.15.0"
|
||||
|
@ -7795,7 +7794,7 @@ moment-timezone@0.5.4:
|
|||
dependencies:
|
||||
moment ">= 2.6.0"
|
||||
|
||||
moment@2.13.0, moment@2.x.x, "moment@>= 2.6.0", moment@^2.10.3, moment@^2.10.6, moment@^2.7.0, moment@~2.13.0:
|
||||
moment@2.13.0, moment@2.x.x, "moment@>= 2.6.0", moment@^2.10.3, moment@^2.10.6, moment@^2.13.0, moment@^2.7.0:
|
||||
version "2.13.0"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.13.0.tgz#24162d99521e6d40f99ae6939e806d2139eaac52"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue