Skip to content
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

Parsing ISO8601 date with .000Z no longer works. #155

Closed
geoherna opened this issue Sep 20, 2022 · 3 comments
Closed

Parsing ISO8601 date with .000Z no longer works. #155

geoherna opened this issue Sep 20, 2022 · 3 comments
Labels
Fixed Bug fixed

Comments

@geoherna
Copy link

geoherna commented Sep 20, 2022

Hello,

I encountered an issue with parsing an ISO8601 timestamp when the ".000Z" is included. This used to work as expected in my previously used version v2.0.1, but this to not work anymore.

Consider the following code:

carbon.Parse("2022-04-01T23:00:00.000Z").IsZero()

golang version: 1.18

carbon version: v2.1.9

I expected to get:

false

But I actually get:

true

On a quick investigation, it seems that the removal of the following block might be the cause of the issue:

if strings.Index(value, "T") == 10 {

Noticed this only happened when upgraded to v2.1.9

Thanks!

@geoherna geoherna added the Bug Report a reproducible bug or regression label Sep 20, 2022
@geoherna
Copy link
Author

Going to close this issue — seems like I answered my own question with the example posted. The solution was to simply use ParseByLayout with RFC3339Format as the layout.

@gouguoyin
Copy link
Member

Yes, at present, the Parse() method is too restrictive and not general enough, and is being optimized

@gouguoyin
Copy link
Member

It has been fixed in 1.7.0 or 2.2.0

@gouguoyin gouguoyin added Fixed Bug fixed and removed Bug Report a reproducible bug or regression labels Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Bug fixed
Development

No branches or pull requests

2 participants