1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-01 13:47:27 +02:00

iron out some date bugs

This commit is contained in:
Thomas Heartman 2025-05-07 11:12:15 +02:00
parent 275cac95c5
commit c14bbe4955
2 changed files with 13 additions and 3 deletions

View File

@ -28,7 +28,7 @@ const AddValuesButton = styled('button')(({ theme }) => ({
}));
interface AddValuesProps {
onAddValues: (newValues: Set<string>) => void;
onAddValues: (newValues: string[]) => void;
helpText?: string;
validator: (...values: string[]) => ConstraintValidatorOutput;
}

View File

@ -84,6 +84,7 @@ export const EditableConstraintWrapper = ({
) {
return cleanConstraint({
...state,
contextName: action.payload,
operator: DATE_AFTER,
values: new Set(),
value: new Date().toISOString(),
@ -95,8 +96,8 @@ export const EditableConstraintWrapper = ({
return cleanConstraint({
...state,
operator: IN,
contextName: action.payload,
values: new Set(),
value: '',
});
}
@ -109,11 +110,20 @@ export const EditableConstraintWrapper = ({
value: '',
});
case 'set operator':
if (
dateOperators.includes(state.operator) &&
dateOperators.includes(action.payload)
) {
return cleanConstraint({
...state,
operator: action.payload,
value: state.value,
});
}
return cleanConstraint({
...state,
operator: action.payload,
values: new Set(),
value: '',
});
case 'add value(s)': {