Skip to content
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

[BUG] You can enter an issued_at date without a time. Hijinks ensue. #4313

Open
cielf opened this issue Apr 28, 2024 · 7 comments
Open

[BUG] You can enter an issued_at date without a time. Hijinks ensue. #4313

cielf opened this issue Apr 28, 2024 · 7 comments

Comments

@cielf
Copy link
Collaborator

cielf commented Apr 28, 2024

Summary

It is possible to enter an issued_at date without a time. If you do, the date is not properly saved.

Why investigate?

Possible reduction of support issues.

Details

See discussion in #3530
Enter a new (or edit a) distribution. Change the date to a different day, but blank out the time. Save.
It saves as today. Weird.

This is not incredibly high priority, as we've made it so the user has to go out of their way to enter an issued_at date without a time.

Criteria for completion

[] Figure out how we could fix this
[] Either put in a PR to fix it, comment the heck out of it on this issue and raise it to the senior folks attention, or come to the Sunday meeting to discuss.

@MohanThanigaivelan
Copy link

Hi @cielf , Can I take up this one if available ?

@dorner
Copy link
Collaborator

dorner commented May 15, 2024

Go for it!

@github-actions github-actions bot removed the Help Wanted Groomed + open to all! label May 15, 2024
@MohanThanigaivelan
Copy link

MohanThanigaivelan commented May 16, 2024

Thanks @dorner . As per my analysis so far, browser validation is set to false here.

config.browser_validations = false

If enabled it would have shown like this in chrome and prevented the form submission.
browser validation

Will try to find a way a solution of achieving something similar to this without updating browser_validations config .

@MohanThanigaivelan
Copy link

MohanThanigaivelan commented May 19, 2024

Hi @dorner ,

I think , we can solve this in three ways.

  1. Prevent users from manually typing in the datetime field and ensure they only use a date-time picker.
  2. Enable browser validations only for this form . Browser prevents from form submission and automatically displays an error message indicating which field needs to be corrected.
  3. When user clicks Save , before proceeding with the submission , validate the date time and display a custom error message in a popup if validation fails

Which one do you prefer is the best ? I prefer option 1 due to simplicity .

@MohanThanigaivelan
Copy link

@dorner / @cielf , Can you check my above comment ? thanks

@cielf
Copy link
Collaborator Author

cielf commented May 20, 2024

Hey @MohanThanigaivelan -- I definitely want @dorner's take on this.

If we were to go with #1, we'd want to have the same restriction in some other places, for consistency's sake. There might be accessibility issues with not allowing the text input, though. (need to check if our current datepicker meets the appropriate standards)

The other two may introduce an inconsistent look and feel, which can be confusing to users.

@dorner
Copy link
Collaborator

dorner commented May 22, 2024

Yeah, I wouldn't want to choose #1 - locking things down unless you have JS working is kind of a last resort.

If we can detect the bad date/time on the controller side, I'd rather validate it there and punt them back with an error. We should be able to do this in a reusable way so all date-time fields can make use of that logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants