Commit c9ddfab4 authored by Jacob Schatz's avatar Jacob Schatz

moves the date to the right place

parent 1b98ee75
...@@ -45,7 +45,7 @@ class DueDateSelect { ...@@ -45,7 +45,7 @@ class DueDateSelect {
initDatePicker() { initDatePicker() {
const $dueDateInput = $(`input[name='${this.fieldName}']`); const $dueDateInput = $(`input[name='${this.fieldName}']`);
const dateFix = DateFix.dashedFix($dueDateInput.val());
const calendar = new Pikaday({ const calendar = new Pikaday({
field: $dueDateInput.get(0), field: $dueDateInput.get(0),
theme: 'gitlab-theme', theme: 'gitlab-theme',
...@@ -63,7 +63,7 @@ class DueDateSelect { ...@@ -63,7 +63,7 @@ class DueDateSelect {
} }
}); });
calendar.setDate(DateFix.dashedFix($dueDateInput.val())); calendar.setDate(dateFix);
this.$datePicker.append(calendar.el); this.$datePicker.append(calendar.el);
this.$datePicker.data('pikaday', calendar); this.$datePicker.data('pikaday', calendar);
} }
...@@ -169,6 +169,7 @@ class DueDateSelectors { ...@@ -169,6 +169,7 @@ class DueDateSelectors {
initMilestoneDatePicker() { initMilestoneDatePicker() {
$('.datepicker').each(function() { $('.datepicker').each(function() {
const $datePicker = $(this); const $datePicker = $(this);
const dateFix = DateFix.dashedFix($datePicker.val());
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',
...@@ -179,7 +180,7 @@ class DueDateSelectors { ...@@ -179,7 +180,7 @@ class DueDateSelectors {
} }
}); });
calendar.setDate(DateFix.dashedFix($datePicker.val())); calendar.setDate(dateFix);
$datePicker.data('pikaday', calendar); $datePicker.data('pikaday', calendar);
}); });
......
const DateFix = { const DateFix = {
dashedFix(val) { dashedFix(val) {
const [y, m, d] = val.split('-'); const [y, m, d] = val.split('-');
console.log(y,m,d)
return new Date(y, m - 1, d); return new Date(y, m - 1, d);
} }
} }
......
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