Created
March 17, 2020 11:01
-
-
Save tdgroot/e113ea7bd17d522c8e5e540fcbcf9501 to your computer and use it in GitHub Desktop.
Magento 2.3 patch for pull request magento/magento#27311
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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(); | |
}, | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, works great!