Methods
appendRegistration(registration) → {Object}
Append a validated registration to localStorage.
Parameters:
| Name | Type | Description |
|---|---|---|
registration |
Object | Validated registration data. |
Returns:
- Saved registration data.
- Type
- Object
buildValidDate(year, month, day) → {Date|null}
Build a date and ensure day/month/year are real.
Parameters:
| Name | Type | Description |
|---|---|---|
year |
Number | Year component. |
month |
Number | Month component (1-12). |
day |
Number | Day component (1-31). |
Returns:
- Date when valid, otherwise null.
- Type
- Date | null
calculateAge(birthDate) → {Number}
Calculate a person's age in years.
Parameters:
| Name | Type | Description |
|---|---|---|
birthDate |
Date | The birth date of the person. |
Returns:
- The age in years of the person.
- Type
- Number
calculateAge()
- Source:
clearFormData()
Clear the form data object from localStorage.
getFormData() → {Object}
Get the form data object from localStorage.
Returns:
- The form data object.
- Type
- Object
getRegistrations() → {Array.<Object>}
Get registrations list from localStorage.
Returns:
- Registrations list.
- Type
- Array.<Object>
handleSubmit(e)
Handle the form submission event.
Parameters:
| Name | Type | Description |
|---|---|---|
e |
Event | The form submission event. |
handleSubmit()
- Source:
isAdult(dateOfBirth) → {Boolean}
Check if the date of birth string is an adult.
Parameters:
| Name | Type | Description |
|---|---|---|
dateOfBirth |
Date | The date of birth to check. |
Returns:
- True if the date of birth string is an adult, false otherwise.
- Type
- Boolean
isFrenchCodePostal(codePostal) → {Boolean}
Check if the code postal is a valid French code postal.
Parameters:
| Name | Type | Description |
|---|---|---|
codePostal |
String | The code postal string to check. |
Returns:
- True if the code postal is a valid French code postal, false otherwise.
- Type
- Boolean
isFrenchCodePostal()
- Source:
localStorage helpers()
- Source:
parseDateOfBirth(rawDateOfBirth) → {Date|null}
Parse date of birth from supported formats:
YYYY-MM-DD, YYYY/MM/DD, DD/MM/YYYY, DD-MM-YYYY.
Parameters:
| Name | Type | Description |
|---|---|---|
rawDateOfBirth |
String | The date string to parse. |
Returns:
- Parsed date if valid, otherwise null.
- Type
- Date | null
registrations localStorage helpers()
- Source:
saveFormData(formData)
Save the form data object to localStorage.
Parameters:
| Name | Type | Description |
|---|---|---|
formData |
Object | The form data object to save. |
saveRegistrations(registrations)
Save registrations list to localStorage.
Parameters:
| Name | Type | Description |
|---|---|---|
registrations |
Array.<Object> | Registrations list. |
validateCodePostal(codePostal) → {String}
Validate the code postal string.
Parameters:
| Name | Type | Description |
|---|---|---|
codePostal |
String | The code postal string to validate. |
Returns:
- The validated code postal string.
- Type
- String
validateCodePostal()
- Source:
validateDateOfBirth(dateOfBirth) → {String}
Validate the date of birth string.
Parameters:
| Name | Type | Description |
|---|---|---|
dateOfBirth |
String | The date of birth string to validate. |
Returns:
- The validated date of birth string.
- Type
- String
validateDateOfBirth()
- Source:
validateEmail(email) → {String}
Validate the email string.
Parameters:
| Name | Type | Description |
|---|---|---|
email |
String | The email string to validate. |
Returns:
- The validated email string.
- Type
- String
validateEmail()
- Source:
validateFormData(formData) → {Object}
Validate the form data object.
Parameters:
| Name | Type | Description |
|---|---|---|
formData |
FormData | The form data object to validate. |
Returns:
- The validated form data object.
- Type
- Object
validateFormData()
- Source:
validateName(name) → {String}
Validate the name string.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | The name string to validate. |
Returns:
- The validated name string.
- Type
- String
validateName()
- Source:
validatePrenom(prenom) → {String}
Validate the prenom string.
Parameters:
| Name | Type | Description |
|---|---|---|
prenom |
String | The prenom string to validate. |
Returns:
- The validated prenom string.
- Type
- String
validatePrenom()
- Source:
validateVille(ville) → {String}
Validate the ville string.
Parameters:
| Name | Type | Description |
|---|---|---|
ville |
String | The ville string to validate. |
Returns:
- The validated ville string.
- Type
- String
validateVille()
- Source: