Skip to content

Fix start and end times when editing a broadcast message on firefox

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 produces 2023-02-21 17:06:16 UTC format, whereas the object itself has this format Tue, 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 the 2023-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

similar fix in !112595 (merged)

Screenshots or screen recordings

browser before after
firefox Screenshot_2023-03-29_at_2.45.32_PM Screenshot_2023-03-29_at_2.47.18_PM
chrome Screenshot_2023-03-29_at_3.28.12_PM no change

How to set up and validate locally

  1. In Chrome
  2. Go to broadcast messages on your local gdk: http://gdk.test:3000/admin/broadcast_messages
  3. Create a broadcast message with start and end times.
  4. Notice it listed on http://gdk.test:3000/admin/broadcast_messages
  5. Go to edit it and notice the start and end time filled out.
  6. In Firefox:
  7. Go to broadcast messages http://gdk.test:3000/admin/broadcast_messages
  8. Go to edit the one that was created and notice the start and end time filled out.
  9. 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.

Related to #397678

Edited by Doug Stull

Merge request reports

Loading