-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add missing validation to admission period backend #66
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to use the frontend with these changes in backend. 😮 If the backend is to expect the format YYYY-MM-DD validating it through regex, you have to update the frontend to send it in that format. ✂️
Another alternative is to find another way to validate the date completely. I don't have any tips at the moment for that, but I know handling dates are tricky 😅
I will take a closer look on the format for how the frontend sends tha dates. The reason for using regex was that I haven't found a good way to validate date yet. Validating dates are some tricky stuff |
Since you have the ISO 8601 format on the datestrings, you can parse it with The advantage I see for this approach is that the frontend doesn't need to care about what format it sends, as long as it at least has YYYY-MM-DD. The con is that strings such as I won't necessarily say its more clean, but it is a solution! |
Thanks for the suggestions, I have used some of them in the new version of the code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't test this without updated fixtures 😁
When I load now admissionPeriodResponse is { start_date: undefined, end_date: undefined }
. Can you check that frontend loads and works for you after you update and load fixtures?
…01) and add date-fns package
…e with dayjs-package in backend
b49655e
to
3661bfa
Compare
I have now changed the code so it works with the fixture. It also works through frontend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, one can send in silly values like 2420-69-69, but at least it does not crash anything. 🥂
It also sends nice error-messages back and works as expected. I suggested a small improvement to the commenting, but either way you have done a great job 🎇
LGTM 🚀
Oh, nice you found that. Originally there was a check for non-existing dates, but it must have gone missing somewhere. I have implemented it again in the latest fix-commit |
Closes #52
Summary of changes
Testing
The code can be tested both through frontend and Postman.