lcbrq/magento2-dateformatpatch

修复lib-icu不一致性返回不同地区模式的补丁

安装: 237

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 5

分支: 0

开放问题: 0

类型:magento2-module

1.0.0 2017-10-27 12:03 UTC

This package is not auto-updated.

Last update: 2024-09-17 18:08:26 UTC


README

针对 Magento 2 中 "Invalid input datetime format of value" +00201717 问题,又一款补丁。

问题可能源于不严格的 IntlDateFormatter 行为,根据 ICU 数据版本的差异返回 'dd.MM.y' 或 'dd.MM.yyyy' 的简短模式。

<?php

date_default_timezone_set("Europe/Warsaw");
locale_set_default('en_US_POSIX');

$format = (new \IntlDateFormatter(
        'pl_PL', \IntlDateFormatter::SHORT, \IntlDateFormatter::NONE
        ))->getPattern();

echo $format;

结果可以是 dd.MM.y 或 dd.MM.yyyy,其中 Magento 接受 datetime 元素中的 dd.MM.y。