Timerange: Fixes a bug where custom time ranges didn't respect UTC (#18217)

* Timerange: Fixes a bug where custom timeranges didn't respect UTC
Closes #18170
Closes #18178
This commit is contained in:
kay delaney
2019-07-24 11:00:36 +01:00
committed by GitHub
parent 1e5fc76601
commit 0752a09f92
3 changed files with 28 additions and 5 deletions

View File

@@ -5,6 +5,18 @@ import { TimeZone } from '../types';
const units: DurationUnit[] = ['y', 'M', 'w', 'd', 'h', 'm', 's'];
export function isMathString(text: string | DateTime | Date): boolean {
if (!text) {
return false;
}
if (typeof text === 'string' && (text.substring(0, 3) === 'now' || text.includes('||'))) {
return true;
} else {
return false;
}
}
/**
* Parses different types input to a moment instance. There is a specific formatting language that can be used
* if text arg is string. See unit tests for examples.