Commit e73cfbd4 authored by Jacob Schatz's avatar Jacob Schatz

Fix date bug in JS that makes dates not work with strings

parent 6c26fb35
...@@ -168,6 +168,7 @@ class DueDateSelectors { ...@@ -168,6 +168,7 @@ class DueDateSelectors {
initMilestoneDatePicker() { initMilestoneDatePicker() {
$('.datepicker').each(function() { $('.datepicker').each(function() {
const $datePicker = $(this); const $datePicker = $(this);
const [y, m, d] = $datePicker.val().split('-');
const calendar = new Pikaday({ const calendar = new Pikaday({
field: $datePicker.get(0), field: $datePicker.get(0),
theme: 'gitlab-theme animate-picker', theme: 'gitlab-theme animate-picker',
...@@ -177,7 +178,8 @@ class DueDateSelectors { ...@@ -177,7 +178,8 @@ class DueDateSelectors {
$datePicker.val(dateFormat(new Date(dateText), 'yyyy-mm-dd')); $datePicker.val(dateFormat(new Date(dateText), 'yyyy-mm-dd'));
} }
}); });
calendar.setDate(new Date($datePicker.val()));
calendar.setDate(new Date(y, m-1, d));
$datePicker.data('pikaday', calendar); $datePicker.data('pikaday', calendar);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment