From a88833c7830c2bb469430eb54c93cab19e64de6e Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 4 Nov 2024 12:39:05 +0100 Subject: [PATCH] Fix tablelistview test due to timezone switch (#198759) ## Summary Fix https://github.com/elastic/kibana/issues/198744 Test was subtracting 7 days, but there is 1 hour less now, so the test setup is incorrect. Fixing it by using moment to handle time switch edge case --- .../table_list_view_table/src/table_list_view.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/content-management/table_list_view_table/src/table_list_view.test.tsx b/packages/content-management/table_list_view_table/src/table_list_view.test.tsx index 38e05299184e4..38229399f2ec8 100644 --- a/packages/content-management/table_list_view_table/src/table_list_view.test.tsx +++ b/packages/content-management/table_list_view_table/src/table_list_view.test.tsx @@ -242,8 +242,8 @@ describe('TableListView', () => { const updatedAtValues: Moment[] = []; const updatedHits = hits.map(({ id, attributes, references }, i) => { - const updatedAt = new Date(new Date().setDate(new Date().getDate() - (7 + i))); - updatedAtValues.push(moment(updatedAt)); + const updatedAt = moment().subtract(7 + i, 'days'); + updatedAtValues.push(updatedAt); return { id,