From 266cce9309cc661cab1200b046124b22467e45aa Mon Sep 17 00:00:00 2001 From: David Conner Date: Mon, 6 Mar 2023 10:32:49 -0500 Subject: [PATCH 1/3] fix(datetimepicker): add check for mask value --- .../DateTimePicker/DateTimePickerV2.test.jsx | 12 ++++++++++++ .../DateTimePickerV2WithTimeSpinner.jsx | 2 +- .../components/DateTimePicker/dateTimePickerUtils.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx b/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx index df8fb6fc13..fcdffcb759 100644 --- a/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx +++ b/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx @@ -2817,4 +2817,16 @@ describe('DateTimePickerV2', () => { expect(onApply).toHaveBeenCalledTimes(1); }); }); + + it('should render without a time picker', () => { + render( + + ); + expect(screen.getByText(PRESET_VALUES[0].label)).toBeVisible(); + }); }); diff --git a/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx b/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx index 5a2ec88cde..28bc58227d 100644 --- a/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx +++ b/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx @@ -341,7 +341,7 @@ const DateTimePicker = ({ const is24hours = useMemo(() => { const [, time] = dateTimeMask.split(' '); const hoursMask = time?.split(':')[0]; - return hoursMask.includes('H'); + return hoursMask ? hoursMask.includes('H') : false; }, [dateTimeMask]); const isSingleSelect = useMemo(() => datePickerType === 'single', [datePickerType]); diff --git a/packages/react/src/components/DateTimePicker/dateTimePickerUtils.js b/packages/react/src/components/DateTimePicker/dateTimePickerUtils.js index 97457e7068..cf1e048a41 100644 --- a/packages/react/src/components/DateTimePicker/dateTimePickerUtils.js +++ b/packages/react/src/components/DateTimePicker/dateTimePickerUtils.js @@ -16,7 +16,7 @@ const { iotPrefix } = settings; const is24hours = (dateTimeMask) => { const [, time] = dateTimeMask.split(' '); const hoursMask = time?.split(':')[0]; - return hoursMask.includes('H'); + return hoursMask ? hoursMask.includes('H') : false; }; /** convert time from 12 hours to 24 hours, if time12hour is 24 hours format, return immediately From b622d4657967634cab3d75c49cb52a3038e176aa Mon Sep 17 00:00:00 2001 From: David Conner Date: Mon, 6 Mar 2023 10:41:39 -0500 Subject: [PATCH 2/3] chore(datetimepicker): change test name --- .../src/components/DateTimePicker/DateTimePickerV2.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx b/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx index fcdffcb759..3206e830f8 100644 --- a/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx +++ b/packages/react/src/components/DateTimePicker/DateTimePickerV2.test.jsx @@ -2818,7 +2818,7 @@ describe('DateTimePickerV2', () => { }); }); - it('should render without a time picker', () => { + it('should render without a time picker and a mask that does not include time', () => { render( Date: Mon, 6 Mar 2023 12:23:34 -0500 Subject: [PATCH 3/3] fix(header): rtl mode had menu rendering off screen --- packages/react/src/components/Header/_header.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react/src/components/Header/_header.scss b/packages/react/src/components/Header/_header.scss index 12cb1629b2..dc33996a04 100644 --- a/packages/react/src/components/Header/_header.scss +++ b/packages/react/src/components/Header/_header.scss @@ -49,6 +49,10 @@ $hoverBgColor: #2c2c2c; &__menu-title[role='menuitem'][aria-expanded='true'] + &__menu { left: auto; right: 0; + [dir='rtl'] & { + left: 0; + right: auto; + } } &__menu {