moves the date to the right place

This commit is contained in:
Jacob Schatz 2017-07-18 15:03:29 -04:00
parent 1b98ee7538
commit c9ddfab4df
2 changed files with 4 additions and 4 deletions

View file

@ -45,7 +45,7 @@ class DueDateSelect {
initDatePicker() {
const $dueDateInput = $(`input[name='${this.fieldName}']`);
const dateFix = DateFix.dashedFix($dueDateInput.val());
const calendar = new Pikaday({
field: $dueDateInput.get(0),
theme: 'gitlab-theme',
@ -63,7 +63,7 @@ class DueDateSelect {
}
});
calendar.setDate(DateFix.dashedFix($dueDateInput.val()));
calendar.setDate(dateFix);
this.$datePicker.append(calendar.el);
this.$datePicker.data('pikaday', calendar);
}
@ -169,6 +169,7 @@ class DueDateSelectors {
initMilestoneDatePicker() {
$('.datepicker').each(function() {
const $datePicker = $(this);
const dateFix = DateFix.dashedFix($datePicker.val());
const calendar = new Pikaday({
field: $datePicker.get(0),
theme: 'gitlab-theme animate-picker',
@ -179,7 +180,7 @@ class DueDateSelectors {
}
});
calendar.setDate(DateFix.dashedFix($datePicker.val()));
calendar.setDate(dateFix);
$datePicker.data('pikaday', calendar);
});

View file

@ -1,7 +1,6 @@
const DateFix = {
dashedFix(val) {
const [y, m, d] = val.split('-');
console.log(y,m,d)
return new Date(y, m - 1, d);
}
}