Remove default value

[MAILPOET-3222]
This commit is contained in:
Pavel Dohnal
2021-04-29 11:28:14 +02:00
committed by Veljko V
parent 8b447e9904
commit 704be5da3d
2 changed files with 4 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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>