-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
DateTimeToLocalizedStringTransformer ignoring time during reverse transform between timezones #20806
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
Comments
The reverse transformation ignores text without time because time zones influences just time. If you are inputting a date, you wouldn't like that to be changed because the system is implying 00:00:00 and that means the previous day in a latter timezone. Maybe the behavior is not perfect, but that stems from the fact that PHP doesn't have a
..which is the "normal" behavior of a programmer: using implied timezone (which probably isn't UTC). |
This problem seems to be caused by IntlDateFormatter stubs. /cc @webmozart @HeahDude |
Damn, this reverses a previous PR where I was involved. I understand why is that like that, but now I'm just desiring so bad a |
@HeahDude I don't think so. As before I said, this problem doesn't seem to be See following snippet - the POC for my opinion on my env (PHP 7.0): date_default_timezone_set('Asia/Tokyo'); // My timezone.
$pattern = 'yyyy-MM-dd';
$nativeIntlDf = new \IntlDateFormatter('en', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, 'UTC', \IntlDateFormatter::GREGORIAN, $pattern);
$polyfillIntlDf = new \Symfony\Component\Intl\DateFormatter\IntlDateFormatter('en', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, 'UTC', \IntlDateFormatter::GREGORIAN, $pattern);
var_dump(
$nativeIntlDf->parse('2017-01-01'), // 1483228800
$polyfillIntlDf->parse('2017-01-01') // 1483196400
);
This timestamp is passed to So we have to fix Regards. |
I've just opened a new issue about this problem. |
Ok, thanks! Let's close here then as the original issue is about the transformer and has been fixed by #21218. |
Updating from symfony v2.8.9 to v.2.8.10 one of my project's tests has started to fail, it looks like it was introduced here c951bb6
I'm not entirely sure if it's a bug with symfony or my project, as it looks like that commit purposely ignores datetime strings without a time.
I have reproduced my project's failing test in DateTimeToLocalizedStringTransformerTest: rcwsr@f605b85
The text was updated successfully, but these errors were encountered: