Skip to content

Commit

Permalink
Use dateFormat from advanced settings for notebook visualizations (#297)
Browse files Browse the repository at this point in the history
closes #250

Signed-off-by: Joshua Li <joshuali925@gmail.com>
  • Loading branch information
joshuali925 authored Dec 7, 2021
1 parent 47a944e commit 2c3c674
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ exports[`<ParaOutput /> spec renders visualization outputs 1`] = `
class="euiText euiText--small"
style="margin-left: 9px;"
>
07/21/2020 06:37 PM - 08/20/2020 06:37 PM
2020-07-21T18:37:44+00:00 - 2020-08-20T18:37:44+00:00
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
DashboardContainerInput,
DashboardStart,
} from '../../../../../../../src/plugins/dashboard/public';
import { UI_DATE_FORMAT } from '../../../../../common/constants/shared';
import { ParaType } from '../../../../../common/types/notebooks';
import { uiSettingsService } from '../../../../../common/utils';
import { QueryDataGridMemo } from './para_query_grid';

/*
Expand Down Expand Up @@ -106,8 +106,9 @@ export const ParaOutput = (props: {
</EuiText>
);
case 'VISUALIZATION':
let from = moment(visInput?.timeRange?.from).format(UI_DATE_FORMAT);
let to = moment(visInput?.timeRange?.to).format(UI_DATE_FORMAT);
const dateFormat = uiSettingsService.get('dateFormat');
let from = moment(visInput?.timeRange?.from).format(dateFormat);
let to = moment(visInput?.timeRange?.to).format(dateFormat);
from = from === 'Invalid date' ? visInput.timeRange.from : from;
to = to === 'Invalid date' ? visInput.timeRange.to : to;
return (
Expand Down

0 comments on commit 2c3c674

Please sign in to comment.