amlan-roy / resume-craft

Resume Craft: Your go-to platform for effortlessly tailoring ATS-friendly resumes to job descriptions. Streamline your job application process and stand out in the competitive market.
https://resume-craft-ten.vercel.app
7 stars 3 forks source link

Invalid Error Message in the date fields of form #46

Closed amlan-roy closed 9 months ago

amlan-roy commented 9 months ago

Describe the bug

When we open the /enter-data route and try to submit the form when any date input already has some valid data pre-filled into it, then we see an error message "Expected date, received string". This is invalid since the pre-filled data should already be a valid data.

Steps To Reproduce

  1. Locally serve the repository by running "npm run dev"
  2. go to http://localhost:3000/enter-data
  3. Enter the required data, and submit the data (Make sure that at least one date is selected in any of the sections)
  4. Save the data
  5. Again go to http://localhost:3000/enter-data
  6. Do not enter any data, directly try to submit the data
  7. The date field shows error "Expected date, received string"

Expected result

Error should not be shown since we have already submitted the form once

Screenshots

image

Are you willing to contribute to this issue?

Yes, but help is always welcomed.

Additional Details

This issue is probably because of startDate: z.date().optional().nullish() and endDate: z.date().optional().nullish() of durationFieldSchema in the file src\lib\types\form.ts. Try changing date() to string() and see if the issue is resolved.

Make sure to test different scenarios like:

  1. When only start date is selected
  2. When start date and end date both are selected
  3. When start date and current checkbox are selected