D7520: dateutil: correct default for Ymd in parsedate

quark (Jun Wu) phabricator at mercurial-scm.org
Tue Nov 26 09:48:47 EST 2019


Closed by commit rHGaef7b91dba51: dateutil: correct default for Ymd in parsedate (authored by quark).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7520?vs=18392&id=18396

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7520/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7520

AFFECTED FILES
  mercurial/utils/dateutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/dateutil.py b/mercurial/utils/dateutil.py
--- a/mercurial/utils/dateutil.py
+++ b/mercurial/utils/dateutil.py
@@ -209,6 +209,8 @@
     True
     >>> tz == strtz
     True
+    >>> parsedate(b'2000 UTC', formats=extendeddateformats)
+    (946684800, 0)
     """
     if bias is None:
         bias = {}
@@ -244,7 +246,8 @@
                 if part[0:1] in b"HMS":
                     b = b"00"
                 else:
-                    b = b"0"
+                    # year, month, and day start from 1
+                    b = b"1"
 
             # this piece is for matching the generic end to today's date
             n = datestr(now, b"%" + part[0:1])



To: quark, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list