php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76226 Wrong Year for the last 5 Days of the year in fa_IR
Submitted: 2018-04-16 07:46 UTC Modified: 2018-04-16 08:06 UTC
From: adeli dot farhad at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: intl (PECL)
PHP Version: 5.6.35 OS: Win10,CentOs6
Private report: No CVE-ID: None
 [2018-04-16 07:46 UTC] adeli dot farhad at gmail dot com
Description:
------------
tested on php 5.6 and 7
timezone : 'Asia/Tehran'
IntlDateFormatter
locale 'fa_IR' OR "fa_IR@calendar=persian"

This happens only in the last 5-6 days of each year (12/25-26 to 12/30-31)
Only when pattern!=null
the value for the year belongs to the next year (year is +1)

example :
2018/3/17 should be 1396/12/26

for locale = 'en_US@calendar=persian' its correct
BUT
for locale = 'fa_IR' OR 'fa_IR@calendar=persian' I am getting ۱۳۹۷/۱۲/۲۶ which is 1397/12/26 notice the year(1397 instead of 1396)


Test script:
---------------
https://gist.github.com/Exlord/57dac123f119b9bb102b2ccf8f590d2b


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-16 07:59 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Package: Calendar related +Package: intl -Assigned To: +Assigned To: cmb
 [2018-04-16 07:59 UTC] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Use $pattern2 = 'y/MM/d';
 [2018-04-16 08:10 UTC] sjon at hortensius dot net
I've tested your code here: https://3v4l.org/eg2U3 and it seems to support your bug #FYI
 [2018-04-16 08:11 UTC] adeli dot farhad at gmail dot com
OMG, I am so sorry, I did not notice that 'Y' is upper cased :D .
Tanks for fast reply.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC