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

Cannot parse 2015-06-10 00:00:00 GMT+02:00 #78

Open
kurilov opened this issue Dec 24, 2018 · 4 comments · May be fixed by #159
Open

Cannot parse 2015-06-10 00:00:00 GMT+02:00 #78

kurilov opened this issue Dec 24, 2018 · 4 comments · May be fixed by #159

Comments

@kurilov
Copy link

kurilov commented Dec 24, 2018

Revision: 21df004e09ca46e07ce99bbba1e8c2422ba4ecf9
Example link: https://www.e-marketing.fr/Thematique/social-media-1096/Breves/Banque-Postale-mise-marketing-temps-reel-impression-255997.htm#WQ17awvif7mWRLVy.97
Test Case

func TestDateParse(t *testing.T) {
	_, err := dateparse.ParseAny("2015-06-10 00:00:00 GMT+02:00")
	assert.NoError(t, err)
}

Result


Error Trace:	date_extractor_test.go:80
Error:      	Received unexpected error:
	            	parsing time "2015-06-10 00:00:00 GMT+02:00" as "2006-01-02 15:04:05 MST-07000": cannot parse ":00" as "-0700"
Test:       	TestDateParse
@araddon
Copy link
Owner

araddon commented Jan 2, 2019

Do you mind clarifying for me is the "2015-06-10" October 6th 2015 or is that June 10th 2015, just to be absolutely sure.

@araddon
Copy link
Owner

araddon commented Jan 2, 2019

Hm, seems go doesn't really like that offset format (seems to not support the combo of GMT[+-]hh:mm ie with the colon?) https://play.golang.org/p/fjk2fFKNAwu

package main

import (
	"fmt"
	"time"
)

func main() {
	t, err := time.Parse("2006-01-02 15:04:05 MST-07:00","2015-10-06 00:00:00 GMT+02:00")
	fmt.Printf("1 t=%v   err=%v\n\n", t, err)
}

1 t=0001-01-01 00:00:00 +0000 UTC err=parsing time "2015-10-06 00:00:00 GMT+02:00" as "2006-01-02 15:04:05 MST-07:00": cannot parse ":00" as "-07:00"

@kurilov
Copy link
Author

kurilov commented Jan 17, 2019

Yes, the problem is definitely in the format. :(

@arran4
Copy link

arran4 commented Feb 15, 2023

I think I got it in my pr: #151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants