Fix start and end times when editing a broadcast message on firefox
requested to merge 397678-when-editing-broadcast-messages-dates-and-or-times-are-forgotten-both-in-firefox-just-hours into master
What does this MR do and why?
- Firefox does not handle creating a
Date
object from a string fomatted with-
(dashes) as seen in #397678 in this function- Chrome is more forgiving and is not an issue there.
- converting with a
.to_s
on the dates produces2023-02-21 17:06:16 UTC
format, whereas the object itself has this formatTue, 21 Feb 2023 17:06:16.000000000 UTC +00:00
- The
dateString
format should conform to the ISO 8601 format (YYYY-MM-DDTHH:mm:ss.sssZ)
listed in https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date. If not, as stated on that page:the parsing behavior with other formats is implementation-defined and may not work across all browsers
which is likely what we were observing with the2023-02-21 17:06:16 UTC
that was being passed before with firefox.- So while this looks to be fixed with using
.iso8601
format to ensure compliance and also match other places for broadcast message
- So while this looks to be fixed with using
similar fix in !112595 (merged)
Screenshots or screen recordings
browser | before | after |
---|---|---|
firefox | ||
chrome | no change |
How to set up and validate locally
- In Chrome
- Go to broadcast messages on your local gdk:
http://gdk.test:3000/admin/broadcast_messages
- Create a broadcast message with start and end times.
- Notice it listed on
http://gdk.test:3000/admin/broadcast_messages
- Go to edit it and notice the start and end time filled out.
- In Firefox:
- Go to broadcast messages
http://gdk.test:3000/admin/broadcast_messages
- Go to edit the one that was created and notice the start and end time filled out.
- Notice the difference between master and this branch on display of start and end times on the edit of broadcast message
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #397678
Edited by Doug Stull