Skip to content

Fix Safari displaying NaN for selected due date

Bryce Johnson requested to merge safari-is-baNaNas into master

What does this MR do?

  1. Stops using Date.parse to parse selected due dates.
  2. Refactors DueDateSelectors to be more maintainable and readable

Are there points in the code the reviewer needs to double check?

To review the actual fix, look here: https://gitlab.com/gitlab-org/gitlab-ce/commit/4ad43ac3a12902d7ea01dc09f8a361b01c21a0ee. It would be difficult to pick out from the overall diff.

Why was this MR needed?

In Safari, the due date selector was displaying 'NaN' when a date is selected, which was being returned by Date.parse. Because Date.parse is implemented differently across browsers it's generally recommended to favor implicit Date parsing with the Date constructor. For more background on this, see MDN on Date.parse.

Also, the code for DueDateSelector was pretty messy, and its logic was very tightly coupled, so I refactored it. None of the basic logic changed, I just broke it up into smaller pieces and made it more OO.

Screenshots (if relevant)

Before: Screen_Shot_2016-10-11_at_9.56.20_AM After: 2016-10-11_12.46.28

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22984

Merge request reports