[BUGFIX] Mark input fields edited by datepicker as changed 00/60300/3
authorDaniel Goerz <daniel.goerz@posteo.de>
Wed, 20 Mar 2019 15:42:08 +0000 (16:42 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 22 Mar 2019 11:52:44 +0000 (12:52 +0100)
Resolves: #87966
Releases: master, 9.5
Change-Id: Ia693015ece7b0ff3fb9f3d322b9914a1daf67b55
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60300
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Resources/Private/TypeScript/DateTimePicker.ts
typo3/sysext/backend/Resources/Public/JavaScript/DateTimePicker.js

index af53eb6..1d4d4a3 100644 (file)
@@ -103,7 +103,7 @@ class DateTimePicker {
           }
           $hiddenField.val(value);
 
-          $(document).trigger('formengine.dp.change', [$(this)]);
+          $(document).trigger('formengine.dp.change', [$element]);
         });
       });
     }
index 7364eb8..7e18f30 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","jquery","moment","./Storage/Persistent"],function(e,t,a,i,r){"use strict";return new(function(){function t(){var e=this;this.fieldSelector=".t3js-datetimepicker",this.format=(null!=opener&&void 0!==opener.top.TYPO3?opener.top:top).TYPO3.settings.DateTimePicker.DateFormat,a(function(){e.initialize()})}return t.formatDateForHiddenField=function(e,t){return"time"!==t&&"timesec"!==t||e.year(1970).month(0).date(1),e.format()},t.prototype.initialize=function(){var n=this,o=a(this.fieldSelector).filter(function(e,t){return void 0===a(t).data("DateTimePicker")});o.length>0&&e(["twbs/bootstrap-datetimepicker"],function(){var e=r.get("lang");"ch"===e&&(e="zh-cn");var d=!!e&&i.locale(e);o.each(function(e,t){n.initializeField(a(t),d)}),o.on("blur",function(e){var r=a(e.currentTarget),n=r.parent().parent().find('input[type="hidden"]');if(""===r.val())n.val("");else{var o=r.data("dateType"),d=r.data("DateTimePicker").format(),f=i.utc(r.val(),d);f.isValid()?n.val(t.formatDateForHiddenField(f,o)):r.val(t.formatDateForHiddenField(i.utc(n.val()),o))}}),o.on("dp.change",function(e){var i=a(e.currentTarget),r=i.parent().parent().find("input[type=hidden]"),o=i.data("dateType"),d="";""!==i.val()&&(d=t.formatDateForHiddenField(e.date.utc(),o)),r.val(d),a(document).trigger("formengine.dp.change",[a(n)])})})},t.prototype.initializeField=function(e,t){var a=this.format,r={format:"",locale:"",sideBySide:!0,showTodayButton:!0,toolbarPlacement:"bottom",icons:{time:"fa fa-clock-o",date:"fa fa-calendar",up:"fa fa-chevron-up",down:"fa fa-chevron-down",previous:"fa fa-chevron-left",next:"fa fa-chevron-right",today:"fa fa-calendar-o",clear:"fa fa-trash"}};switch(e.data("dateType")){case"datetime":r.format=a[1];break;case"date":r.format=a[0];break;case"time":r.format="HH:mm";break;case"timesec":r.format="HH:mm:ss";break;case"year":r.format="YYYY"}e.data("dateMindate")&&e.data("dateMindate",i.unix(e.data("dateMindate")).format(r.format)),e.data("dateMaxdate")&&e.data("dateMaxdate",i.unix(e.data("dateMaxdate")).format(r.format)),t&&(r.locale=t),e.datetimepicker(r)},t}())});
\ No newline at end of file
+define(["require","exports","jquery","moment","./Storage/Persistent"],function(e,t,a,i,r){"use strict";return new(function(){function t(){var e=this;this.fieldSelector=".t3js-datetimepicker",this.format=(null!=opener&&void 0!==opener.top.TYPO3?opener.top:top).TYPO3.settings.DateTimePicker.DateFormat,a(function(){e.initialize()})}return t.formatDateForHiddenField=function(e,t){return"time"!==t&&"timesec"!==t||e.year(1970).month(0).date(1),e.format()},t.prototype.initialize=function(){var n=this,o=a(this.fieldSelector).filter(function(e,t){return void 0===a(t).data("DateTimePicker")});o.length>0&&e(["twbs/bootstrap-datetimepicker"],function(){var e=r.get("lang");"ch"===e&&(e="zh-cn");var d=!!e&&i.locale(e);o.each(function(e,t){n.initializeField(a(t),d)}),o.on("blur",function(e){var r=a(e.currentTarget),n=r.parent().parent().find('input[type="hidden"]');if(""===r.val())n.val("");else{var o=r.data("dateType"),d=r.data("DateTimePicker").format(),f=i.utc(r.val(),d);f.isValid()?n.val(t.formatDateForHiddenField(f,o)):r.val(t.formatDateForHiddenField(i.utc(n.val()),o))}}),o.on("dp.change",function(e){var i=a(e.currentTarget),r=i.parent().parent().find("input[type=hidden]"),n=i.data("dateType"),o="";""!==i.val()&&(o=t.formatDateForHiddenField(e.date.utc(),n)),r.val(o),a(document).trigger("formengine.dp.change",[i])})})},t.prototype.initializeField=function(e,t){var a=this.format,r={format:"",locale:"",sideBySide:!0,showTodayButton:!0,toolbarPlacement:"bottom",icons:{time:"fa fa-clock-o",date:"fa fa-calendar",up:"fa fa-chevron-up",down:"fa fa-chevron-down",previous:"fa fa-chevron-left",next:"fa fa-chevron-right",today:"fa fa-calendar-o",clear:"fa fa-trash"}};switch(e.data("dateType")){case"datetime":r.format=a[1];break;case"date":r.format=a[0];break;case"time":r.format="HH:mm";break;case"timesec":r.format="HH:mm:ss";break;case"year":r.format="YYYY"}e.data("dateMindate")&&e.data("dateMindate",i.unix(e.data("dateMindate")).format(r.format)),e.data("dateMaxdate")&&e.data("dateMaxdate",i.unix(e.data("dateMaxdate")).format(r.format)),t&&(r.locale=t),e.datetimepicker(r)},t}())});
\ No newline at end of file