-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix ISO8601 bug #862
Fix ISO8601 bug #862
Conversation
@lucasmichot I think your changes revert the BC break, so they "could" make sense after all. |
Yeah but is this really a BC - or more an expected behaviour as per your comment in #861 ? It's not that obvious |
Ya I mentioned awhile ago that its a breaking change but also a bug fix to implement correct behaviour. I guess the issue is people are relying on the incorrect behaviour so thats why its a break. I had changed it to use the atom format awhile ago but I guess it never got released. I guess save it for 2.0 at this point to mimic PHP behaviour. |
It's probably worth noting that technically both formats are valid under ISO8601, but PHP's default handling of dates ( |
@@ -81,7 +81,7 @@ public function testToLocalizedFormattedDateStringWhenUtf8IsNedded() | |||
* $cache = setlocale(LC_TIME, 0); | |||
* $d = Carbon::create(2016, 01, 06, 00, 00, 00); | |||
* setlocale(LC_TIME, 'spanish'); | |||
* $this->assertSame(utf8_encode('mi�rcoles 06 enero 2016'), $d->formatLocalized('%A %d %B %Y')); | |||
* $this->assertSame(utf8_encode('mi�rcoles 06 enero 2016'), $d->formatLocalized('%A %d %B %Y')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
potential encoding error in your client here, maybe?
@briannesbitt I think that even if PHP does not exactly the ISO, it should be worth to merge this in |
@lucasmichot PHP isn't actually wrong, however: ISO8601 is a very large standard. Both |
Thanks for making it clearer @ameliaikeda |
I wrote a little blog post on this issue: https://dev.karriere.at/a/iso-8601-dates-in-php-and-browsers |
Why not? You can use negative timestamp, like this: https://eval.in/958817 |
@Glavic You are right, this works in PHP and in browsers. I will update the article. |
Won't fix as we do not wish to align on a PHP documented bug. If you need the legacy ISO8601 format, just use |
Fix ISO8601 BC
FIx #861