Re: bug: notmuch cannot handle invalid Date fields

Subject: Re: bug: notmuch cannot handle invalid Date fields

Date: Wed, 22 Apr 2015 15:42:39 +0200

To: notmuch@notmuchmail.org

Cc:

From: Johannes Schauer


Hi,

Quoting Tomi Ollila (2015-04-22 15:37:15)
> What do you mean by that datetime cannot handle dates before 1900 ?
> 
> :  $ python
> :  Python 2.7.6 (default, Mar 22 2014, 22:59:56)
> :  ...
> :  >>> datetime.datetime.strptime('1799-11', '%Y-%m')
> :  datetime.datetime(1799, 11, 1, 0, 0)
> :  >>> x=datetime.datetime.strptime('1799-11', '%Y-%m')
> :  >>> x.isoformat()
> :  '1799-11-01T00:00:00'

from the docs:

"The exact range of years for which strftime() works also varies across
platforms. Regardless of platform, years before 1900 cannot be used."

or:

$ python
Python 2.7.9 (default, Dec 11 2014, 08:58:12) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> x=datetime.datetime.strptime('1799-11', '%Y-%m')
>>> x.strftime("%P")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: year=1799 is before 1900; the datetime strftime() methods require year >= 1900


cheers, josch
signature.asc (application/pgp-signature)

Thread: