kgabryje commented on code in PR #30848:
URL: https://github.com/apache/superset/pull/30848#discussion_r1830844574


##########
superset-frontend/packages/superset-ui-chart-controls/src/sections/timeComparison.tsx:
##########
@@ -94,9 +98,29 @@ export const timeComparisonControls: ({
         name: 'start_date_offset',
         config: {
           type: 'TimeOffsetControl',
-          label: t('shift start date'),
+          label: t('Shift start date'),
           visibility: ({ controls }) =>
             controls?.time_compare.value === 'custom',
+          mapStateToProps: (
+            state: ControlPanelState,
+            controlState: ControlState,
+          ) => {
+            const { form_data } = state;
+            const { time_compare } = form_data;
+            const newState = { ...controlState };
+            if (
+              time_compare === 'custom' &&
+              (controlState.value === '' ||
+                controlState.value === 'Invalid date')

Review Comment:
   Can we write a small unit test for that „Invalid date” string to future 
proof it in case it ever changes in momentjs?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to