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

cal.parse('2015-11-18') returns November 19th 2015 #145

Closed
simonw opened this issue Nov 19, 2015 · 2 comments
Closed

cal.parse('2015-11-18') returns November 19th 2015 #145

simonw opened this issue Nov 19, 2015 · 2 comments

Comments

@simonw
Copy link

simonw commented Nov 19, 2015

I'm not sure if this is intended behavior, but I found this very confusing:

>>> import parsedatetime
>>> cal = parsedatetime.Calendar()
>>> cal.parse('2015-11-18')
((2015, 11, 19, 20, 15, 0, 3, 323, 0), 2)

Is this a bug in the library, or am I misunderstanding something about how this function should be used? Is there an alternative way to use this library that would result in "2015-11-18" coming out as Nov 18th (not November 19th).

@bear
Copy link
Owner

bear commented Nov 19, 2015

I believe you are hitting issue #133 which we have fixed in the master branch but not yet released as we are pushing to release on both v2.7 and v3.5 for python support

>>> import parsedatetime
>>> parsedatetime.__version__
u'2.0'
>>> c = parsedatetime.Calendar()
>>> c.parse('2015-11-18')
(time.struct_time(tm_year=2015, tm_mon=11, tm_mday=18, tm_hour=17, tm_min=50, tm_sec=21, tm_wday=3, tm_yday=323, tm_isdst=0), 1)

you will also notice that the returned datetime is struct_time value and not just a tuple

@simonw
Copy link
Author

simonw commented Nov 20, 2015

Confirmed, this bug is fixed in master. Thanks for the quick reply!

@simonw simonw closed this as completed Nov 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants