fixed bug with uk zip code and add retrieved timestamp for dewars at the beamline

This commit is contained in:
GotthardG
2024-12-12 11:59:42 +01:00
parent fd17c0e672
commit 6c88ff9651
5 changed files with 28 additions and 68 deletions

View File

@ -78,7 +78,11 @@ const ShipmentForm: React.FC<ShipmentFormProps> = ({ sx = {}, onCancel, refreshS
const validateEmail = (email: string) => /\S+@\S+\.\S+/.test(email);
const validatePhoneNumber = (phone: string) => /^\+?[1-9]\d{1,14}$/.test(phone);
const validateZipCode = (zipcode: string) => /^\d{5}(?:[-\s]\d{4})?$/.test(zipcode);
const validateZipCode = (zipcode: string) => {
const usZipCodeRegex = /^\d{4,5}(?:[-\s]\d{4})?$/;
const ukPostCodeRegex = /^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/i;
return usZipCodeRegex.test(zipcode) || ukPostCodeRegex.test(zipcode);
};
const isContactFormValid = () => {
const { firstname, lastname, phone_number, email } = newContactPerson;