Fix year is changed after save and closing of datepicker when click arrow.

pull/2900/head
mhirtie 10 years ago
parent 086a346cf0
commit b1a8ffe3a6
  1. 2
      frontend/app/templates/components/inplace_editor/date/date_range_picker.html
  2. 17
      frontend/app/ui_components/date/date-range-picker-directive.js

@ -1,7 +1,7 @@
<div class="inplace-edit--date-range">
<input type="text" class="inplace-edit--date-range-start-date" execute-on-enter="execute()" ng-model="startDate" />
<div class="inplace-edit--date-range-start-date-picker"></div>
<span>-</span>
<input type="text" class="inplace-edit--date-range-end-date" execute-on-enter="execute()" ng-model="endDate"/>
<div class="inplace-edit--date-range-start-date-picker"></div>
<div class="inplace-edit--date-range-end-date-picker"></div>
</div>

@ -64,8 +64,8 @@ module.exports = function(TimezoneService, ConfigurationService,
prevEndDate = '',
setDate = function(div, input, date) {
if(date) {
div.datepicker('option', 'defaultDate', formattedDate(date));
div.datepicker('option', 'setDate', formattedDate(date));
div.datepicker('option', 'defaultDate', customFormattedDate(date));
div.datepicker('option', 'setDate', customFormattedDate(date));
input.val(customFormattedDate(date));
} else {
div.datepicker('option', 'defaultDate', null);
@ -138,6 +138,7 @@ module.exports = function(TimezoneService, ConfigurationService,
showWeeks: true,
changeMonth: true,
dateFormat: datepickerFormat,
defaultDate: customFormattedDate(scope.startDate),
inline: true,
alterOffset: function(offset) {
var wHeight = angular.element(window).height(),
@ -168,6 +169,7 @@ module.exports = function(TimezoneService, ConfigurationService,
showWeeks: true,
changeMonth: true,
dateFormat: datepickerFormat,
defaultDate: customFormattedDate(scope.endDate),
inline: true,
alterOffset: function(offset) {
var wHeight = angular.element(window).height(),
@ -196,11 +198,11 @@ module.exports = function(TimezoneService, ConfigurationService,
if(scope.endDate) {
prevEndDate = formattedDate(scope.endDate);
divStart.datepicker('option', 'maxDate', formattedDate(scope.endDate));
divStart.datepicker('option', 'maxDate', customFormattedDate(scope.endDate));
}
if(scope.startDate) {
prevStartDate = formattedDate(scope.startDate);
divEnd.datepicker('option', 'minDate', formattedDate(scope.startDate));
divEnd.datepicker('option', 'minDate', customFormattedDate(scope.startDate));
}
setDate(divStart, inputStart, scope.startDate);
@ -209,14 +211,14 @@ module.exports = function(TimezoneService, ConfigurationService,
inputStart.click().focus();
});
inputStart.on('click', function() {
inputStart.on('click focusin', function() {
if(divStart.is(':hidden') || divEnd.is(':visible')) {
divEnd.hide();
divStart.show();
}
});
inputEnd.on('click', function() {
inputEnd.on('click focusin', function() {
if(divEnd.is(':hidden') || divStart.is(':visible')) {
divEnd.show();
divStart.hide();
@ -226,7 +228,8 @@ module.exports = function(TimezoneService, ConfigurationService,
angular.element('.work-packages--details-content').on('click', function(e) {
var target = angular.element(e.target);
if(!target.is('.inplace-edit--date-range input') &&
target.parents('.inplace-edit--date-range .hasDatepicker').length <= 0) {
target.parents('.hasDatepicker').length <= 0 &&
target.parents('.ui-corner-all').length <= 0) {
divStart.hide();
divEnd.hide();
}

Loading…
Cancel
Save