-
Rémy Coutable authored
Fix Safari displaying NaN for selected due date ## 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](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/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. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22984 See merge request !6797 Signed-off-by: Rémy Coutable <remy@rymai.me>
7bd0b8ec