Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
timeRaw.from.local();
}
if (isDateTime(timeRaw.to)) {
timeRaw.to.local();
}
this.isUtc = false;
} else {
this.isUtc = true;
}
this.rangeString = rangeUtil.describeTimeRange(timeRaw);
this.absolute = { fromJs: time.from.toDate(), toJs: time.to.toDate() };
this.tooltip = this.dashboard.formatDate(time.from) + ' <br>to<br>';
this.tooltip += this.dashboard.formatDate(time.to);
this.timeRaw = timeRaw;
this.isAbsolute = isDateTime(this.timeRaw.to);
}
onRefresh() {
const time = angular.copy(this.timeSrv.timeRange());
const timeRaw = angular.copy(time.raw);
if (!this.dashboard.isTimezoneUtc()) {
time.from.local();
time.to.local();
if (isDateTime(timeRaw.from)) {
timeRaw.from.local();
}
if (isDateTime(timeRaw.to)) {
timeRaw.to.local();
}
this.isUtc = false;
} else {
this.isUtc = true;
}
this.rangeString = rangeUtil.describeTimeRange(timeRaw);
this.absolute = { fromJs: time.from.toDate(), toJs: time.to.toDate() };
this.tooltip = this.dashboard.formatDate(time.from) + ' <br>to<br>';
this.tooltip += this.dashboard.formatDate(time.to);
this.timeRaw = timeRaw;
this.isAbsolute = isDateTime(this.timeRaw.to);
}
const getRaw = (range: any, timeZone: TimeZone) => {
const rawRange = {
from: range.raw.from,
to: range.raw.to,
};
if (isDateTime(rawRange.from)) {
if (timeZone === 'browser') {
rawRange.from = rawRange.from.local();
}
rawRange.from = rawRange.from.format(TIME_FORMAT);
}
if (isDateTime(rawRange.to)) {
if (timeZone === 'browser') {
rawRange.to = rawRange.to.local();
}
rawRange.to = rawRange.to.format(TIME_FORMAT);
}
return rawRange;
};
const toUser = currentValue => {
if (isDateTime(currentValue)) {
return currentValue.format(format);
} else {
return currentValue;
}
};
const toRawTimeRange = (range: TimeRange): RawTimeRange => {
let from = range.raw.from;
if (isDateTime(from)) {
from = from.valueOf().toString(10);
}
let to = range.raw.to;
if (isDateTime(to)) {
to = to.valueOf().toString(10);
}
return {
from,
to,
};
};
onRefresh() {
const time = angular.copy(this.timeSrv.timeRange());
const timeRaw = angular.copy(time.raw);
if (!this.dashboard.isTimezoneUtc()) {
time.from.local();
time.to.local();
if (isDateTime(timeRaw.from)) {
timeRaw.from.local();
}
if (isDateTime(timeRaw.to)) {
timeRaw.to.local();
}
this.isUtc = false;
} else {
this.isUtc = true;
}
this.rangeString = rangeUtil.describeTimeRange(timeRaw);
this.absolute = { fromJs: time.from.toDate(), toJs: time.to.toDate() };
this.tooltip = this.dashboard.formatDate(time.from) + ' <br>to<br>';
this.tooltip += this.dashboard.formatDate(time.to);
this.timeRaw = timeRaw;
this.isAbsolute = isDateTime(this.timeRaw.to);
const toRawTimeRange = (range: TimeRange): RawTimeRange => {
let from = range.raw.from;
if (isDateTime(from)) {
from = from.valueOf().toString(10);
}
let to = range.raw.to;
if (isDateTime(to)) {
to = to.valueOf().toString(10);
}
return {
from,
to,
};
};
const getRaw = (range: any, timeZone: TimeZone) => {
const rawRange = {
from: range.raw.from,
to: range.raw.to,
};
if (isDateTime(rawRange.from)) {
if (timeZone === 'browser') {
rawRange.from = rawRange.from.local();
}
rawRange.from = rawRange.from.format(TIME_FORMAT);
}
if (isDateTime(rawRange.to)) {
if (timeZone === 'browser') {
rawRange.to = rawRange.to.local();
}
rawRange.to = rawRange.to.format(TIME_FORMAT);
}
return rawRange;
};