Skip to content

Commit

Permalink
Fix redirect with relative dates
Browse files Browse the repository at this point in the history
  • Loading branch information
crespocarlos committed Sep 8, 2023
1 parent 311c665 commit 49cf601
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function useDateRangeProvider({
useEffectOnce(() => {
const { from, to } = getParsedDateRange();

// forces the date picker to initiallize with absolute dates.
// forces the date picker to initialize with absolute dates.
setUrlState({ dateRange: { from, to } });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import React from 'react';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiButtonEmpty } from '@elastic/eui';
import { useLinkProps } from '@kbn/observability-shared-plugin/public';
import { parse } from '@kbn/datemath';
import { useNodeDetailsRedirect } from '../../../pages/link_to';
import { Asset } from '../types';
import type { InventoryItemType } from '../../../../common/inventory_models/types';
import { toTimestampRange } from '../utils';
import { useAssetDetailsUrlState } from '../hooks/use_asset_details_url_state';

export interface LinkToNodeDetailsProps {
Expand All @@ -32,7 +32,8 @@ export const LinkToNodeDetails = ({ asset, assetType }: LinkToNodeDetailsProps)
search: {
name: asset.name,
...assetDetails,
...(dateRange ? toTimestampRange({ from: dateRange.from, to: dateRange.to }) : undefined),
from: parse(dateRange?.from ?? '')?.valueOf(),
to: parse(dateRange?.to ?? '')?.valueOf(),
},
}),
});
Expand Down

0 comments on commit 49cf601

Please sign in to comment.