-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#11236] Uninformative error message for incorrectly typed date input #11524
[#11236] Uninformative error message for incorrectly typed date input #11524
Conversation
Hi @ziqing26, these parts of your pull request do not appear to follow our contributing guidelines:
|
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.
1b9dd15
to
f6f4ec0
Compare
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.
This backend approach certainly works (at least for the feedback session pages, probably not for audit logs or other pages?), but I'm wondering if there might be a way to deal with the errors in the frontend instead?
If the date is invalid, the resolveLocalDateTime
method returns NaN instead of a proper number, which appears to cause the issue. This NaN is then passed to the backend as a null or some other invalid value, and so the error is eventually thrown by the backend.
My feeling though is that it might be better to raise an error and deal with it purely on the frontend, rather than pass it on to the backend -- plus these error messages (should be more than zero/should not be null) might strictly speaking be more appropriate for backend developers too
Okay I can look into that! |
7aa853f
to
b494cf0
Compare
src/web/app/pages-instructor/instructor-audit-logs-page/instructor-audit-logs-page.component.ts
Outdated
Show resolved
Hide resolved
src/web/app/pages-instructor/instructor-audit-logs-page/instructor-audit-logs-page.component.ts
Outdated
Show resolved
Hide resolved
src/main/java/teammates/ui/request/FeedbackSessionBasicRequest.java
Outdated
Show resolved
Hide resolved
aac346e
to
fe96717
Compare
src/web/app/pages-instructor/instructor-sessions-page/instructor-sessions-page.component.ts
Outdated
Show resolved
Hide resolved
Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢 |
1 similar comment
Guys, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢 |
Hi @ziqing26, kind reminder on this issue. |
954e6f0
to
ed0beb7
Compare
ee2160a
to
5617838
Compare
@halfwhole The latest commit updates one test case for the selective deadline which is affected. Thank you again! |
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.
Looks good to me, thanks a lot for this!
If the date is invalid, the `resolveLocalDateTime` method returns NaN instead of a proper number. This NaN is then passed to the backend as an invalid value, and so the error is eventually thrown by the backend with unclear error messages. Let's * raise the error in frontend for invalid date range before it is passed to backend. * handle the error using try-catch blocks in frontend as well.
Let's * Keep only the relevant time range code in try catch loop. * Remove instance checks of error.
5617838
to
8c74d25
Compare
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.
LGTM 💯 Thanks for helping to close both issues!
Fixes #11236
FIxes #11556
Outline of Solution
Add
readonly
attribute to datepicker in audit log page.Update (12 Apr 2022):
This branch is now rebased from the branch in #11562 to reuse code related to e2e. After that, new commits fix failing e2e tests for: