Skip to content

Instantly share code, notes, and snippets.

@tdgroot
Created March 17, 2020 11:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tdgroot/e113ea7bd17d522c8e5e540fcbcf9501 to your computer and use it in GitHub Desktop.
Magento 2.3 patch for pull request magento/magento#27311
--- view/base/web/js/form/element/date.orig.js 2019-09-19 12:30:58.000000000 +0200
+++ view/base/web/js/form/element/date.js 2020-03-17 11:51:49.691288844 +0100
@@ -111,21 +111,19 @@
* Prepares and sets date/time value that will be displayed
* in the input field.
*
- * @param {String} value
+ * @inheritDoc
*/
- onValueChange: function (value) {
- var shiftedValue;
+ setInitialValue: function () {
+ const value = this.getInitialValue();
+ let shiftedValue;
if (value) {
if (this.options.showsTime) {
shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone);
} else {
- shiftedValue = moment(value, this.outputDateFormat);
- }
-
- if (!shiftedValue.isValid()) {
shiftedValue = moment(value, this.inputDateFormat);
}
+
shiftedValue = shiftedValue.format(this.pickerDateTimeFormat);
} else {
shiftedValue = '';
@@ -134,6 +132,8 @@
if (shiftedValue !== this.shiftedValue()) {
this.shiftedValue(shiftedValue);
}
+
+ return this._super();
},
/**
@Aquive
Copy link

Aquive commented Aug 28, 2020

Thanks, works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment