Global

Members

(constant) nameRegex

French name regex (allows accents, hyphens, spaces)
Source:

(constant) postalCodeRegex

French postal code regex (5 digits)
Source:

(constant) registrationSchema :z.ZodObject

Zod schema for user registration form validation
Type:
  • z.ZodObject
Properties:
Name Type Description
firstName z.ZodString User's first name (min 2 chars, French name format)
lastName z.ZodString User's last name (min 2 chars, French name format)
email z.ZodString User's email address
birthDate z.ZodDate User's birth date (must be at least 18 years ago)
city z.ZodString User's city (min 2 chars, French name format)
postalCode z.ZodString User's postal code (5 digits)
Source:

Methods

calculateAge(p) → {number}

Calculate a person's age in years
Parameters:
Name Type Description
p object An object representing a person, implementing a birth Date parameter
Source:
Returns:
The age of the person (p) in years
Type
number

isAtLeast18YearsAgo(date) → {boolean}

Helper function to check if a date is at least 18 years ago
Parameters:
Name Type Description
date Date The date to check
Source:
Returns:
True if the date is at least 18 years ago, false otherwise
Type
boolean

Type Definitions

RegistrationFormData

Type definition for the registration form data
Type:
  • Object
Properties:
Name Type Description
firstName string User's first name
lastName string User's last name
email string User's email address
birthDate Date User's birth date
city string User's city
postalCode string User's postal code
Source: