-
-
Notifications
You must be signed in to change notification settings - Fork 484
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: CaseContact form date input #5974
Bug: CaseContact form date input #5974
Conversation
use min date constant & I18n in validation
07d08ba
to
b6c2a50
Compare
max: current_date.to_fs(:iso8601), | ||
min: min_date.to_fs(:iso8601), |
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.
Could drop these min/max attributes to handle with model validations only (allow submit & show validation errors). This will prevent selecting bad dates via UI, but user can still type them in, afaik.
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 good with this as if, thanks. Love removing unnecessary dependencies.
There is existing issue where the current inputs don't take into account the timezone of the user is not getting used. So if I enter 8/10/2024 that is saved at 8/10/24 UTC and if I later convert that to EST it becomes 8/9/24 EST.
It would be cool if that could be covered in this PR but I'm totally fine with that being a different PR as well. (Also I'm not 100% if we use the occurred_at
with a timezone)
Yes, feels great when a PR is more red than green! There is some code that grabs time zone from a browser cookie ( Time is always tricky, I like to refer to this thoughtbot article a lot... Might be worth adding a user timezone column for the user to be able to choose? Or having a good fallback. |
I think this PR is kind of the idea of how we would do it in this code base but I guesstimate there are more places incorrectly using timezones than correctly at the moment. |
The occurred_at param is a plain date, sent without any tz info, so saving to UTC, which is good. Potential issues if user is on the 'other side' of the date line from UTC.
America/New York is 4 hours behind UTC, so the first scenario could be happening after 8pm Eastern for users. It may be annoying but not blocking creation, and doesn't sound like this bug as reported. I think incorporating |
Yea for sure not part of this. I was just mentioning it in general. And I has been reported with regards to some notification and email tables in the past. |
What github issue is this PR for, if any?
Addresses #5860
What changed, and why?
Javascript is running (on any page load app wide) that manipulated
#case_contact_occurred_at
field value if it was present. This was probably to ensure it matched previous date picker library format, but app uses browser date pickers now. The manipulation may have been the cause of bug - we have not been able to reproduce the issue. Even if not, this brings date selection in line with standard validation.form.date_field
, plus proper attributes for browser validation, using iso8601 date format standard for browsersHow is this tested? (please write tests!) 💖💪
Unsure how to test as not able to reproduce/browser specific. I think existing system new/edit specs do a lot of date inputting, so I think that's sufficient, but open to suggestions.
Feelings gif (optional)