allow only number in phone number input (#10)
All checks were successful
delpoy / build-and-deploy (push) Successful in 41s

This commit is contained in:
2023-11-30 20:20:12 +01:00
parent 4e16487d3d
commit 971ca4bc75
2 changed files with 26 additions and 6 deletions

View File

@ -39,8 +39,15 @@
async function sendRegister() {
// eslint-disable-next-line no-async-promise-executor
registerRequest = new Promise(async (resolve, reject) => {
if (birthdayInput.valueAsDate || new Date() > new Date(Date.now() - 1000 * 60 * 60 * 24 * 365 * 6)) {
reject(Error('Bitte gib deinen vollständigen Geburtstag und die korrekte Jahreszahl an. Du musst mindestens 6 Jahre alt sein.'))
if (
birthdayInput.valueAsDate ||
new Date() > new Date(Date.now() - 1000 * 60 * 60 * 24 * 365 * 6)
) {
reject(
Error(
'Bitte gib deinen vollständigen Geburtstag und die korrekte Jahreszahl an. Du musst mindestens 6 Jahre alt sein.'
)
);
return;
}
@ -100,7 +107,7 @@
<span slot="label">Geburtstag</span>
<span slot="notice">Die Angabe hat keine Auswirkungen auf das Spielgeschehen</span>
</Input>
<Input id="telephone" name="telephone" type="tel">
<Input id="telephone" name="telephone" type="tel" pattern={new RegExp(/^[+()\s/\d]+$/)}>
<span slot="label">Telefonnummer</span>
<p slot="notice">
Diese nutzen wir, um Dich in der Whatsapp-Gruppe zuzuordnen und kontaktieren zu können.