mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 20:53:24 +10:00
Add validator for email address format
This commit is contained in:
parent
de629316d4
commit
a897c71afd
1 changed files with 9 additions and 0 deletions
|
|
@ -59,3 +59,12 @@ export const bookingDatesRequired = (inValidStartDateMessage, inValidEndDateMess
|
|||
return VALID;
|
||||
}
|
||||
};
|
||||
|
||||
// Source: http://www.regular-expressions.info/email.html
|
||||
// See the link above for an explanation of the tradeoffs.
|
||||
const EMAIL_RE = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
|
||||
|
||||
export const emailFormatValid = message =>
|
||||
value => {
|
||||
return value && EMAIL_RE.test(value) ? VALID : message;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue