mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
fix Moment.js timezone error when defining a range filter (#143213)
This commit is contained in:
parent
9782417578
commit
891e587571
1 changed files with 3 additions and 2 deletions
|
@ -37,12 +37,13 @@ export function isRangeParams(params: any): params is RangeParams {
|
|||
|
||||
function RangeValueInputUI(props: Props) {
|
||||
const kibana = useKibana();
|
||||
const tzConfig = kibana.services.uiSettings!.get('dateFormat:tz');
|
||||
|
||||
const formatDateChange = (value: string | number | boolean) => {
|
||||
if (typeof value !== 'string' && typeof value !== 'number') return value;
|
||||
|
||||
const momentParsedValue = moment(value).tz(tzConfig);
|
||||
const tzConfig = kibana.services.uiSettings!.get('dateFormat:tz');
|
||||
const tz = !tzConfig || tzConfig === 'Browser' ? moment.tz.guess() : tzConfig;
|
||||
const momentParsedValue = moment(value).tz(tz);
|
||||
if (momentParsedValue.isValid()) return momentParsedValue?.format('YYYY-MM-DDTHH:mm:ss.SSSZ');
|
||||
|
||||
return value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue