diff options
author | Paul Ganssle <paul@ganssle.io> | 2018-04-15 12:05:12 -0400 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-04-15 12:20:47 -0400 |
commit | 7959008b8b365cc38dace0005d57b7cdd01fb6fd (patch) | |
tree | 165bbdedfeb6f2a4782db54d7ad14f3ec486b5e1 /dateutil | |
parent | 6b535072b49b348ad095f11bc2d98f6a889b14b1 (diff) | |
download | dateutil-7959008b8b365cc38dace0005d57b7cdd01fb6fd.tar.gz |
Partially revert convertyear refactoring
Diffstat (limited to 'dateutil')
-rw-r--r-- | dateutil/parser/_parser.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/dateutil/parser/_parser.py b/dateutil/parser/_parser.py index c9af04c..79cd2bb 100644 --- a/dateutil/parser/_parser.py +++ b/dateutil/parser/_parser.py @@ -369,19 +369,17 @@ class parserinfo(object): range of self._year (current local time) """ - # only called internally. Should never be negative + # Function contract is that the year is always positive assert year >= 0 - if century_specified or year >= 100: - return year + if year < 100 and not century_specified: + # assume current century to start + year += self._century - # assume current century to start - year += self._century - - if year >= self._year + 50: # if too far in future - year -= 100 - elif year < self._year - 50: # if too far in past - year += 100 + if year >= self._year + 50: # if too far in future + year -= 100 + elif year < self._year - 50: # if too far in past + year += 100 return year |