Skip to content

Commit

Permalink
fix for datepicker issue (#571)
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Wei <[email protected]>
  • Loading branch information
mengweieric authored Mar 10, 2022
1 parent 2407086 commit 433e2d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
2 changes: 1 addition & 1 deletion dashboards-observability/common/utils/query_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const preprocessQuery = ({

// convert to moment
const start = datemath.parse(startTime)?.utc().format(DATE_PICKER_FORMAT);
const end = datemath.parse(endTime)?.utc().format(DATE_PICKER_FORMAT);
const end = datemath.parse(endTime, { roundUp: true })?.utc().format(DATE_PICKER_FORMAT);
const tokens = rawQuery.replaceAll(PPL_NEWLINE_REGEX, '').match(PPL_INDEX_INSERT_POINT_REGEX);

if (isEmpty(tokens)) return finalQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,14 @@
*/

import React from 'react';
import {
EuiFlexItem,
EuiSuperDatePicker
} from '@elastic/eui';
import {
IDatePickerProps
} from './search';
import { EuiSuperDatePicker } from '@elastic/eui';
import { IDatePickerProps } from './search';
import { uiSettingsService } from '../../../../common/utils';

export function DatePicker(props: IDatePickerProps) {
const { startTime, endTime, handleTimePickerChange, handleTimeRangePickerRefresh } = props;

const {
startTime,
endTime,
setStartTime,
setEndTime,
handleTimePickerChange,
handleTimeRangePickerRefresh
} = props;

const handleTimeChange = (e) => {
const start = e.start;
const end = e.start === e.end ? 'now' : e.end;
handleTimePickerChange([start, end]);
};
const handleTimeChange = (e) => handleTimePickerChange([e.start, e.end]);

return (
<EuiSuperDatePicker
Expand All @@ -41,4 +24,4 @@ export function DatePicker(props: IDatePickerProps) {
className="osdQueryBar__datePicker"
/>
);
}
}

0 comments on commit 433e2d1

Please sign in to comment.