Commit bbc2ca40 authored by Orlando Del Aguila's avatar Orlando Del Aguila

save current date before Pikaday init

parent 00c1a58b
......@@ -170,6 +170,8 @@ export default class DueDateSelectors {
initMilestoneDatePicker() {
$('.datepicker').each(function initPikadayMilestone() {
const $datePicker = $(this);
const datePickerVal = $datePicker.val();
const calendar = new Pikaday({
field: $datePicker.get(0),
theme: 'gitlab-theme animate-picker',
......@@ -182,7 +184,7 @@ export default class DueDateSelectors {
},
});
calendar.setDate(parsePikadayDate($datePicker.val()));
calendar.setDate(parsePikadayDate(datePickerVal));
$datePicker.data('pikaday', calendar);
});
......
---
title: "Fixing milestone date change when editing"
merge_request: 20279
author: Orlando Del Aguila
type: fixed
\ No newline at end of file
require "rails_helper"
describe "User edits milestone", :js do
set(:user) { create(:user) }
set(:project) { create(:project) }
set(:milestone) { create(:milestone, project: project, start_date: Date.today, due_date: 5.days.from_now) }
before do
project.add_developer(user)
sign_in(user)
visit(edit_project_milestone_path(project, milestone))
end
it "shows the right start date and due date" do
start_date = milestone.start_date.strftime("%F")
due_date = milestone.due_date.strftime("%F")
expect(page).to have_field(with: start_date)
expect(page).to have_field(with: due_date)
end
end
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