Mercurial > hg
view tests/test-issue1102.t @ 43781:b65bd4b61d78
dateutil: correct default for Ymd in parsedate
The code uses `0` for the default value of Ymd (year, month, and day), which
seems suboptimal. For example, these will fail to parse:
dateutil.parsedate('2000', formats=dateutil.extendeddateformats)
dateutil.parsedate('Jan 2000', formats=dateutil.extendeddateformats)
Fix it by providing sane defaults (1 instead of 0) for year, month, and day.
The suboptimal behavior was introduced by 91bc001a592 (2010-12-29,
"date: fix matching of underspecified date ranges"), which does not seem to
justify the current behavior.
Note end-users should not notice the subtle issue, because there are no formats
in `defaultdateformats` that allow an explicit year with omitted month, or an
explicit month with omitted day.
Differential Revision: https://phab.mercurial-scm.org/D7520
author | Jun Wu <quark@fb.com> |
---|---|
date | Mon, 25 Nov 2019 12:44:04 -0800 |
parents | 4591cd6b6794 |
children | 805419729e11 |
line wrap: on
line source
$ rm -rf a $ hg init a $ cd a $ echo a > a $ hg ci -Am0 adding a $ hg tag t1 # 1 $ hg tag --remove t1 # 2 $ hg co 1 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg tag -f -r0 t1 $ hg tags tip 3:a49829c4fc11 t1 0:f7b1eb17ad24 $ cd ..