php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79858 IntlDateTimeFormatter spec does not match PHP
Submitted: 2020-07-14 13:46 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: m dot smeets at performation dot com Assigned:
Status: Open Package: Date/time related
PHP Version: 7.3.20 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
31 + 48 = ?
Subscribe to this entry?

 
 [2020-07-14 13:46 UTC] m dot smeets at performation dot com
Description:
------------
---
From manual page: https://php.net/class.intldateformatter
---

According to https://www.php.net/manual/en/function.date.php 'Y' is "A full numeric representation of a year, 4 digits" and 'o' is "ISO-8601 week-numbering year. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)"

But in IntlDateFormatter "Y" is "Week of Year", shown in http://userguide.icu-project.org/formatparse/datetime. This means that the following format will be interpreted differently

Test script:
---------------
date = 2018-12-31
format = d-m-Y

PHP date_format "31-12-2019"
IntlDate format "31-12-2020"

Expected result:
----------------
Expected result is the same, but I expect a warning on the PHP IntlDateFormatter page: https://www.php.net/manual/en/class.intldateformatter.php


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-20 01:40 UTC] a at b dot c dot de
The documentation for the IntlDateFormatter constructor does say:

" pattern

    Optional pattern to use when formatting or parsing. Possible patterns are documented at ยป http://userguide.icu-project.org/formatparse/datetime.
"
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Nov 28 05:01:27 2020 UTC