akshitagupta15june / akshitagupta15june/PetMe
🪲[Bug]: Phone Number Validation Issue
- Langage dominant
- HTML
- Étoiles
- 515
- Forks
- 747
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
**Describe the bug**
The current implementation of the phone field in the donationSchema is using the Number type and the trim option, which is not valid for numbers. Additionally, this could lead to the mishandling of phone numbers with leading zeros or country codes.
**To Reproduce**
Steps to reproduce the behavior:
1.) Go to the form where donations are submitted.
2.) Enter a phone number with leading zeros or a country code (e.g., +1234567890).
3.) Submit the form.
4.) Observe that the phone number is not stored correctly in the database, potentially leading to loss of leading zeros or errors in saving the document.
**Expected behavior**
Phone numbers should be stored as strings to preserve formatting, including leading zeros and country codes. The trim option should not be used with the phone field.
**Screenshots**

Description: This screenshot shows the donation form with the phone number field filled with the number "+1234567890"and the form not showing error for invalid number.
**Desktop (please complete the following information):**
- OS: Windows 10
- Browser Chrome
- Version 91.0
**Smartphone (please complete the following information):**
- Device: iPhone 12
- OS: iOS 14.6
- Browser Safari
- Version 14
**Additional context**
The phone number should be validated using a proper validation function to ensure it conforms to a valid phone number format.
Please assign me this issue under GSSOC'24 to solve this bug.
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.