Add fiscal years and search to time picker (#39073)

* Add search to time picker

* implement fiscal datemath

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
This commit is contained in:
Oscar Kilhed
2021-09-30 09:40:02 +02:00
committed by GitHub
parent 787e5e78dd
commit 738d5e499e
30 changed files with 457 additions and 164 deletions

View File

@@ -60,7 +60,11 @@ export class TimeSrv {
// remember time at load so we can go back to it
this.timeAtLoad = cloneDeep(this.time);
const range = rangeUtil.convertRawToRange(this.time, this.dashboard?.getTimezone());
const range = rangeUtil.convertRawToRange(
this.time,
this.dashboard?.getTimezone(),
this.dashboard?.fiscalYearStartMonth
);
if (range.to.isBefore(range.from)) {
this.setTime(
@@ -327,8 +331,8 @@ export class TimeSrv {
const timezone = this.dashboard ? this.dashboard.getTimezone() : undefined;
return {
from: dateMath.parse(raw.from, false, timezone)!,
to: dateMath.parse(raw.to, true, timezone)!,
from: dateMath.parse(raw.from, false, timezone, this.dashboard?.fiscalYearStartMonth)!,
to: dateMath.parse(raw.to, true, timezone, this.dashboard?.fiscalYearStartMonth)!,
raw: raw,
};
}