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

YearParseStyle is ignored for dates in MM/DD style #109

Closed
kevinvance opened this issue Jul 29, 2015 · 2 comments
Closed

YearParseStyle is ignored for dates in MM/DD style #109

kevinvance opened this issue Jul 29, 2015 · 2 comments

Comments

@kevinvance
Copy link

If I try to parse a date before today (e.g. 7/28), the parsed year is returned as next year, regardless of the YearParseStyle option.

>>> import parsedatetime
>>> config = parsedatetime.Constants()
>>> config.YearParseStyle = 0
>>> calendar = parsedatetime.Calendar(config)
>>> calendar.parse('7/28')
DEBUG:parsedatetime:parse()
DEBUG:parsedatetime:parse (top of loop): [7/28][]
DEBUG:parsedatetime:parse (modifier) [][][]
DEBUG:parsedatetime:parse (units) [][][]
DEBUG:parsedatetime:parse (qunits) [][][]
DEBUG:parsedatetime:parse (date3) [][][]
DEBUG:parsedatetime:parse (date) [7/28][][]
DEBUG:parsedatetime:parse (day) [7/28][][]
DEBUG:parsedatetime:parse (weekday) [7/28][][]
DEBUG:parsedatetime:parse (time) [7/28][][]
DEBUG:parsedatetime:parse (meridian) [7/28][][]
DEBUG:parsedatetime:parse (hms) [7/28][][]
DEBUG:parsedatetime:dateFlag 1, timeFlag 0
DEBUG:parsedatetime:parse (bottom) [][7/28][][]
DEBUG:parsedatetime:weekday False, dateStd True, dateStr False, time False, timeStr False, meridian False
DEBUG:parsedatetime:dayStr False, modifier False, units False, qunits False
DEBUG:parsedatetime:_evalString(7/28, None)
DEBUG:parsedatetime:attempt to parse as rfc822 - None
DEBUG:parsedatetime:daysInMonth(7, 2016)
DEBUG:parsedatetime:parseDate: 2016 7 28 31
DEBUG:parsedatetime:parse() return dateFlag 1 timeFlag 0 totalTime (2016, 7, 28, 11, 19, 58, 2, 210, 1)
((2016, 7, 28, 11, 20, 44, 2, 210, 1), 1)

I would expect the returned year to be 2015.

@philiptzou
Copy link
Collaborator

Should works now.

@bear
Copy link
Owner

bear commented Jul 30, 2015

wooo!

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

3 participants