Skip to content

Commit b6a6f18

Browse files
committed
ACP2E-4052: Date filter issue when admin interface language is Japanese
1 parent fab20b0 commit b6a6f18

File tree

2 files changed

+74
-5
lines changed

2 files changed

+74
-5
lines changed

app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
3-
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
6-
*/
3+
/**
4+
* Copyright 2015 Adobe
5+
* All Rights Reserved.
6+
*/
77
-->
88
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
99
<argument name="data" xsi:type="array">
@@ -226,7 +226,6 @@
226226
<column name="dob" class="Magento\Ui\Component\Listing\Columns\Date" component="Magento_Ui/js/grid/columns/date" sortOrder="170">
227227
<settings>
228228
<timezone>false</timezone>
229-
<dateFormat>MMM d, y</dateFormat>
230229
<skipTimeZoneConversion>true</skipTimeZoneConversion>
231230
<filter>dateRange</filter>
232231
<dataType>date</dataType>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Customer\Ui\Component\Listing\Column;
9+
10+
use Magento\Framework\View\Element\UiComponentFactory;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
use PHPUnit\Framework\TestCase;
13+
14+
class DobColumnTest extends TestCase
15+
{
16+
/**
17+
* @var UiComponentFactory
18+
*/
19+
private $uiComponentFactory;
20+
21+
/**
22+
* @inheritdoc
23+
*/
24+
protected function setUp(): void
25+
{
26+
$this->uiComponentFactory = Bootstrap::getObjectManager()->create(UiComponentFactory::class);
27+
}
28+
29+
/**
30+
* Test that dateFormat is not defined in the XML configuration for dob column.
31+
*
32+
* This test verifies that the explicit dateFormat configuration was removed from the XML
33+
* and that the date format is now handled programmatically by the ColumnFactory.
34+
*
35+
* @return void
36+
*/
37+
public function testDobColumnDoesNotHaveDateFormatInXml(): void
38+
{
39+
$xmlPath = BP . '/app/code/Magento/Customer/view/adminhtml/ui_component/customer_listing.xml';
40+
$this->assertFileExists($xmlPath, 'Customer listing XML file should exist');
41+
42+
$xmlContent = file_get_contents($xmlPath);
43+
$this->assertNotFalse($xmlContent, 'Should be able to read XML file');
44+
45+
$xml = simplexml_load_string($xmlContent);
46+
$this->assertNotFalse($xml, 'XML should be valid');
47+
48+
// Find the dob column in the XML
49+
$dobColumn = null;
50+
foreach ($xml->xpath('//column[@name="dob"]') as $column) {
51+
$dobColumn = $column;
52+
break;
53+
}
54+
55+
$this->assertNotNull($dobColumn, 'DOB column should exist in XML');
56+
57+
// Verify that dateFormat is not explicitly set in the XML
58+
$dateFormatNodes = $dobColumn->xpath('.//dateFormat');
59+
$this->assertEmpty($dateFormatNodes, 'dateFormat should not be explicitly set in XML for dob column');
60+
61+
// Verify that other expected settings are still present
62+
$timezoneNodes = $dobColumn->xpath('.//timezone');
63+
$this->assertNotEmpty($timezoneNodes, 'timezone setting should still be present');
64+
$this->assertEquals('false', (string)$timezoneNodes[0], 'timezone should be set to false');
65+
66+
$skipTimeZoneNodes = $dobColumn->xpath('.//skipTimeZoneConversion');
67+
$this->assertNotEmpty($skipTimeZoneNodes, 'skipTimeZoneConversion setting should still be present');
68+
$this->assertEquals('true', (string)$skipTimeZoneNodes[0], 'skipTimeZoneConversion should be set to true');
69+
}
70+
}

0 commit comments

Comments
 (0)