New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Form] Date type does not accept years before 1902/after 2037 #5227
Comments
What is your php version? http://php.net/manual/en/intldateformatter.format.php Try this.
|
Tested on 5.3.14 and 5.4.3 same results (false for years other than 1902-2037) |
Hello! we are getting the same problem here. We are going with 1- here, good luck! |
A hacky workaround: to get the Date form type to accept dates past 2038 on 32-bit systems, At line 320 replace this return $dateTime->getTimestamp(); with this if($year >= 2038 && php_uname('m') === 'i586') return $dateTime->format('U');
else return $dateTime->getTimestamp(); This messes up the hour value of the DateTime, and only works with future dates (i didn't test years 1970 or below), but it's just what I needed. Source: http://www.php.net/manual/en/datetime.gettimestamp.php#99598 |
Does this issue occurs when using the intl extension or the stub intl implementation ? |
Intl extension, 32 bit Ubuntu, installed from ppa PHP 5.3.15-0ppa1p with Suhosin-Patch (cli) (built: Aug 4 2012 03:33:59) On Mon, Oct 22, 2012 at 3:00 PM, Christophe Coevoet <
|
I think that this needs to be resolved in PHP. Have you reported a bug there [1]? In ICU, the dealing of years prior to 1902 seems to work judging from this ticket [2]. But we will know more when the PHP guys respond to the bug report. [1] https://bugs.php.net |
I have this issue too, using Wamp with PHP5.4.3 and intl enabled. Is there any information on how to fix this? |
Just had to modify the \vendor\symfony\src\Symfony\Component\Locale\Stub\DateFormat\FullTransformer.php file. I really don't like to modify a Core Symfony file but I had to... Any news about how to fix that without modifying this symfo file ? |
Again, has anyone reported a bug to php.net? |
I'd like to provide some more insight into this issue. I did a little boundary value analysis, comparing the output of the current function getTimestamp() in the FullTransformer file, and the format("U") function:
This leads me to believe that Tested with |
@aerthel The issue is not (primarily) the FullTransformer file, but PHP's implementation of IntlDateTransformer. FullTransformer is just a stub for the case that the intl extension is not available. |
Thank you for the test results though! |
This is a limitation in PHP itself:
|
64bit version of PHP solves this problem as it does many other when dealing with large integers:
|
Fortunately, this issue seems to be limited to (a) 32bit systems and (b1) the option Marked as documentation issue. See symfony/symfony-docs#2266 |
This PR was squashed before being merged into the 2.2 branch (closes #9314). Discussion ---------- [Form] Fix DateType for 32bits computers. | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #5227,#5554 | License | MIT | Doc PR | - Fix an issue due to 32bits machines, date can be only between 1902-2037. Simply not add date if false. Can be good to add this to 2.3 and master too. Commits ------- b80fb43 [Form] Fix DateType for 32bits computers.
IntlDateFormatter have some issues in transformation of Date.
Expected: string '1900'
Actual: boolean false
Since Date widget base on this formatter, by default it only display years in range 1902-2037.
The text was updated successfully, but these errors were encountered: