Skip to content

Commit ec99a86

Browse files
author
Bohdan Korablov
committed
MAGETWO-94196: [2.1] The fix of incorrect date format was lost since 2.1.13
1 parent 9a0e197 commit ec99a86

File tree

3 files changed

+10
-69
lines changed
  • app/code/Magento
    • Catalog/Ui/DataProvider/Product/Form/Modifier
    • Ui
      • Component/Form/Element/DataType
      • view/base/web/js/form/element

3 files changed

+10
-69
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -255,36 +255,22 @@ protected function customizeNewDateRangeField(array $meta)
255255
$fromContainerPath = $this->arrayManager->slicePath($fromFieldPath, 0, -2);
256256
$toContainerPath = $this->arrayManager->slicePath($toFieldPath, 0, -2);
257257

258-
$commonFieldsMeta = [
259-
'outputDateTimeToISO' => false,
260-
'inputDateTimeFormat' => 'YYYY-MM-DD h:mm',
261-
'options' => [
262-
'showsTime' => true,
263-
]
264-
];
265-
266258
$meta = $this->arrayManager->merge(
267259
$fromFieldPath . self::META_CONFIG_PATH,
268260
$meta,
269-
array_merge(
270-
[
271-
'label' => __('Set Product as New From'),
272-
'additionalClasses' => 'admin__field-date',
273-
],
274-
$commonFieldsMeta
275-
)
261+
[
262+
'label' => __('Set Product as New From'),
263+
'additionalClasses' => 'admin__field-date',
264+
]
276265
);
277266
$meta = $this->arrayManager->merge(
278267
$toFieldPath . self::META_CONFIG_PATH,
279268
$meta,
280-
array_merge(
281-
[
282-
'label' => __('To'),
283-
'scopeLabel' => null,
284-
'additionalClasses' => 'admin__field-date',
285-
],
286-
$commonFieldsMeta
287-
)
269+
[
270+
'label' => __('To'),
271+
'scopeLabel' => null,
272+
'additionalClasses' => 'admin__field-date',
273+
]
288274
);
289275
$meta = $this->arrayManager->merge(
290276
$fromContainerPath . self::META_CONFIG_PATH,

app/code/Magento/Ui/Component/Form/Element/DataType/Date.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ public function prepare()
6565
$storeTimeZone = $this->localeDate->getConfigTimezone();
6666
$config['storeTimeZone'] = $storeTimeZone;
6767
}
68-
69-
if (!empty($config['options']['showsTime'])) {
70-
$config['options']['timeFormat'] = $this->localeDate->getTimeFormat();
71-
}
72-
7368
// Set date format pattern by current locale
7469
$localeDateFormat = $this->localeDate->getDateFormat();
7570
$config['options']['dateFormat'] = $localeDateFormat;

app/code/Magento/Ui/view/base/web/js/form/element/date.js

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ define([
3131
*/
3232
inputDateFormat: 'y-MM-dd',
3333

34-
/**
35-
* Format of date that comes from the
36-
* server (ICU Date Format).
37-
*
38-
* Used only in date/time picker mode
39-
* (this.options.showsTime == false).
40-
*
41-
* @type {String}
42-
*/
43-
inputDateTimeFormat: 'y-MM-dd h:mm',
44-
4534
/**
4635
* Format of date that should be sent to the
4736
* server (ICU Date Format).
@@ -53,25 +42,6 @@ define([
5342
*/
5443
outputDateFormat: 'MM/dd/y',
5544

56-
/**
57-
* Format of date that should be sent to the
58-
* server (ICU Date Format).
59-
*
60-
* Used only in datetime picker mode with disabled ISO format.
61-
* (this.options.showsTime == true, this.options.outputDateTimeToISO == false)
62-
*
63-
* @type {String}
64-
*/
65-
outputDateTimeFormat: '',
66-
67-
/**
68-
* Converts output date/time to ISO string
69-
*
70-
* Used only in datetime picker mode
71-
* (this.options.showsTime == false)
72-
*/
73-
outputDateTimeToISO: true,
74-
7545
/**
7646
* Date/time format that is used to display date in
7747
* the input field.
@@ -144,20 +114,10 @@ define([
144114
shiftedValue;
145115

146116
if (value) {
147-
if (this.options.showsTime && !this.outputDateTimeToISO) {
148-
dateFormat = this.shiftedValue() ?
149-
this.outputDateTimeFormat :
150-
this.inputDateTimeFormat;
151-
152-
value = moment(value, dateFormat).format(this.timezoneFormat);
153-
}
154-
155117
if (this.options.showsTime) {
156118
shiftedValue = moment.tz(value, 'UTC').tz(this.storeTimeZone);
157119
} else {
158-
dateFormat = this.shiftedValue() ?
159-
this.outputDateTimeFormat :
160-
this.inputDateTimeFormat;
120+
dateFormat = this.shiftedValue() ? this.outputDateFormat : this.inputDateFormat;
161121

162122
shiftedValue = moment(value, dateFormat);
163123
}

0 commit comments

Comments
 (0)