diff --git a/packages/react/src/components/DateTimePicker/DateTimePickerV2.jsx b/packages/react/src/components/DateTimePicker/DateTimePickerV2.jsx index 166ef6396f..620c37f04a 100644 --- a/packages/react/src/components/DateTimePicker/DateTimePickerV2.jsx +++ b/packages/react/src/components/DateTimePicker/DateTimePickerV2.jsx @@ -18,6 +18,7 @@ const DateTimePicker = ({ showRelativeOption, showCustomRangeLink, hasTimeInput, + hideBackButton, renderPresetTooltipText, onCancel, onApply, @@ -47,6 +48,7 @@ const DateTimePicker = ({ expanded={expanded} disabled={disabled} invalid={invalid} + hideBackButton={hideBackButton} showRelativeOption={showRelativeOption} showCustomRangeLink={showCustomRangeLink} hasTimeInput={hasTimeInput} diff --git a/packages/react/src/components/DateTimePicker/DateTimePickerV2.story.jsx b/packages/react/src/components/DateTimePicker/DateTimePickerV2.story.jsx index 006024233e..41a82b4d6d 100644 --- a/packages/react/src/components/DateTimePicker/DateTimePickerV2.story.jsx +++ b/packages/react/src/components/DateTimePicker/DateTimePickerV2.story.jsx @@ -223,6 +223,9 @@ export const SelectedAbsoluteWithNewTimeSpinner = () => { hasTimeInput={boolean('hasTimeInput', true)} onApply={action('onApply')} onCancel={action('onCancel')} + showCustomRangeLink={boolean('show custom range link', true)} + hideBackButton={boolean('hide back button', false)} + showRelativeOption={boolean('show the relative option', true)} style={{ zIndex: number('zIndex', 0) }} i18n={object('i18n', { startTimeLabel: 'Start', diff --git a/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx b/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx index e352b10873..35678bc72e 100644 --- a/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx +++ b/packages/react/src/components/DateTimePicker/DateTimePickerV2WithTimeSpinner.jsx @@ -127,6 +127,8 @@ export const propTypes = { ), /** show the picker in the expanded state */ expanded: PropTypes.bool, + /** hide the back button and display cancel button while only using absolute range selector */ + hideBackButton: PropTypes.bool, /** disable the input */ disabled: PropTypes.bool, /** specify the input in invalid state */ @@ -248,6 +250,7 @@ export const defaultProps = { disabled: false, invalid: false, showRelativeOption: true, + hideBackButton: false, showCustomRangeLink: true, hasTimeInput: true, renderPresetTooltipText: null, @@ -312,6 +315,7 @@ const DateTimePicker = ({ showCustomRangeLink, hasTimeInput, renderPresetTooltipText, + hideBackButton, onCancel, onApply, onClear, @@ -749,7 +753,6 @@ const DateTimePicker = ({ const onApplyClick = () => { const value = renderValue(); - setLastAppliedValue(value); const returnValue = { timeRangeKind: value.kind, timeRangeValue: null, @@ -802,6 +805,7 @@ const DateTimePicker = ({ }; break; } + setLastAppliedValue(returnValue); if (onApply && isValid) { setIsExpanded(false); @@ -872,7 +876,7 @@ const DateTimePicker = ({ const CustomFooter = () => { return (