Remove default value
[MAILPOET-3222]
This commit is contained in:
@@ -29,7 +29,7 @@ export function validateSubscriber(formItems: WordpressRoleFormItem): boolean {
|
||||
|| formItems.operator === SubscribedDateOperator.NOT_IN_THE_LAST
|
||||
) {
|
||||
const re = new RegExp(/^\d+$/);
|
||||
return re.test(formItems.value);
|
||||
return re.test(formItems.value) && (Number(formItems.value) > 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -57,9 +57,9 @@ export const SubscribedDateFields: React.FunctionComponent<Props> = ({ onChange,
|
||||
item.operator === SubscribedDateOperator.IN_THE_LAST
|
||||
|| item.operator === SubscribedDateOperator.NOT_IN_THE_LAST
|
||||
)
|
||||
&& ((typeof item.value !== 'string') || !new RegExp(/^\d+$/).exec(item.value))
|
||||
&& ((typeof item.value === 'string') && !new RegExp(/^\d*$/).exec(item.value))
|
||||
) {
|
||||
onChange(assign(item, { value: '1' }));
|
||||
onChange(assign(item, { value: '' }));
|
||||
}
|
||||
}, [onChange, item]);
|
||||
|
||||
@@ -103,7 +103,7 @@ export const SubscribedDateFields: React.FunctionComponent<Props> = ({ onChange,
|
||||
value={item.value}
|
||||
onChange={(e): void => onChange(assign(item, { value: e.target.value }))}
|
||||
min="1"
|
||||
placeholder={MailPoet.I18n.t('wooNumberOfOrdersDaysPlaceholder')}
|
||||
placeholder={MailPoet.I18n.t('daysPlaceholder')}
|
||||
/>
|
||||
)}
|
||||
</Grid.CenteredRow>
|
||||
|
Reference in New Issue
Block a user