Skip to content

Commit 248fcf7

Browse files
committed
Merge remote-tracking branch 'origin/ACP2E-4338' into PR_2025_11_20_flowers
2 parents 590916c + 4268b53 commit 248fcf7

File tree

2 files changed

+38
-6
lines changed
  • app/code/Magento/Ui/view/base/web/js/grid/columns
  • dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns

2 files changed

+38
-6
lines changed

app/code/Magento/Ui/view/base/web/js/grid/columns/date.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ define([
4343
var date;
4444

4545
if (this.storeLocale !== undefined) {
46-
moment.locale(this.storeLocale, utils.extend({}, this.calendarConfig));
46+
moment.updateLocale(this.storeLocale, utils.extend({}, this.calendarConfig));
4747
}
4848

4949
date = moment.utc(this._super());
Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
/**
2-
* Copyright © Magento, Inc. All rights reserved.
3-
* See COPYING.txt for license details.
2+
* Copyright 2015 Adobe
3+
* All Rights Reserved.
44
*/
55

66
/*eslint max-nested-callbacks: 0*/
77
define([
88
'underscore',
9+
'moment',
910
'Magento_Ui/js/grid/columns/date'
10-
], function (_, Date) {
11+
], function (_, moment, Date) {
1112
'use strict';
1213

1314
describe('Ui/js/grid/columns/date', function () {
1415
var date;
1516

1617
beforeEach(function () {
1718
date = new Date({
18-
dataScope: 'abstract'
19-
});
19+
dataScope: 'abstract'
20+
});
2021
});
2122

2223
describe('initConfig method', function () {
@@ -28,5 +29,36 @@ define([
2829
expect(date.dateFormat).toBeDefined();
2930
});
3031
});
32+
33+
describe('getLabel method', function () {
34+
it('uses moment.updateLocale when storeLocale is defined', function () {
35+
var value,
36+
label;
37+
38+
date.storeLocale = 'en_US';
39+
date.calendarConfig = {
40+
week: { dow: 1 }
41+
};
42+
date.index = 'created_at';
43+
44+
date._super = function () {
45+
return '2025-11-18 15:30:00';
46+
};
47+
48+
value = {
49+
created_at: '2025-11-18 15:30:00'
50+
};
51+
52+
spyOn(moment, 'updateLocale').and.callThrough();
53+
54+
label = date.getLabel(value, 'YYYY-MM-DD');
55+
56+
expect(moment.updateLocale).toHaveBeenCalledWith(
57+
'en_US',
58+
jasmine.any(Object)
59+
);
60+
expect(label).toBe('2025-11-18');
61+
});
62+
});
3163
});
3264
});

0 commit comments

Comments
 (0)