diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx index 9297b84de6dbc..9b95e58baac38 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.test.tsx @@ -415,6 +415,21 @@ describe('SharingMetaFields', () => { `); }); + it('Should convert to absolute correctly', () => { + jest.useFakeTimers().setSystemTime(new Date('2024-10-21T10:19:31.254Z')); + + const from = 'now-1d/d'; + const to = 'now-1d/d'; + const component = ; + + expect(shallow(component)).toMatchInlineSnapshot(` +
+ `); + }); + it('Should render the component without data-shared-timefilter-duration if time is not set correctly', () => { const component = ( diff --git a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx index 8321ca9130f54..4d4db4438d74d 100644 --- a/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx +++ b/src/plugins/unified_search/public/query_string_input/query_bar_top_row.tsx @@ -209,7 +209,7 @@ export const SharingMetaFields = React.memo(function SharingMetaFields({ try { const dateRangePretty = usePrettyDuration({ timeFrom: toAbsoluteString(from), - timeTo: toAbsoluteString(to), + timeTo: toAbsoluteString(to, true), quickRanges: [], dateFormat, });