fix(GlDatepicker): fix date parsing when manually entering dates
requested to merge 1556-gldatepicker-one-day-is-subtracted-from-date-after-manually-entering-date into main
What does this MR do?
Related to #1556 (closed)
Currently when you manually enter a date into the GlDatepicker
input it subtracts a day from the date you entered. This is due to a quirk with JavaScript's Date.parse
where dates with dashes are parsed differently than dates with slashes
new Date("2011-09-24");
// => Fri Sep 23 2011 17:00:00 GMT-0700 (MST) - ONE DAY OFF.
new Date("2011/09/24");
// => Sat Sep 24 2011 00:00:00 GMT-0700 (MST) - CORRECT DATE.
This MR adds a custom parser to the Pikaday config to fix the issue.
Before | After |
---|---|
Does this MR meet the acceptance criteria?
Conformity
-
Code review guidelines. -
GitLab UI's contributing guidlines. - [-] If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
- [-] If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
-
If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui
package can be upgraded quickly after the changes are released:-
GitLab: gitlab!71217 (closed) - There are some failing specs but they seem unrelated to this change. Guessing they have to do with !2019 (merged)
- [-] CustomersDot:
GlDatepicker
not used - [-] Status Page:
GlDatepicker
not used
-
-
Added the ~"component:*"
label(s) if applicable.
Edited by Peter Hegman