-
-
Notifications
You must be signed in to change notification settings - Fork 414
Closed
Description
~/sandbox$ python
Python 3.6.5 (default, Nov 14 2018, 15:52:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pendulum import parse
>>> parse("2018-1-1")
DateTime(2018, 11, 1, 0, 0, 0, tzinfo=Timezone('UTC'))
>>> parse("2018-1-2")
DateTime(2018, 12, 1, 0, 0, 0, tzinfo=Timezone('UTC'))
>>> parse("2018-1-3")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zhangclb/.local/env3/lib/python3.6/site-packages/pendulum/parser.py", line 20, in parse
return _parse(text, **options)
File "/home/zhangclb/.local/env3/lib/python3.6/site-packages/pendulum/parser.py", line 36, in _parse
parsed = base_parse(text, **options)
File "/home/zhangclb/.local/env3/lib/python3.6/site-packages/pendulum/parsing/__init__.py", line 70, in parse
return _normalize(_parse(text, **_options), **_options)
File "/home/zhangclb/.local/env3/lib/python3.6/site-packages/pendulum/parsing/__init__.py", line 124, in _parse
raise ParserError("Unable to parse string [{}]".format(text))
pendulum.parsing.exceptions.ParserError: Unable to parse string [2018-1-3]
>>> parse("2018-1-3",strict=False)
DateTime(2018, 1, 3, 0, 0, 0, tzinfo=Timezone('UTC'))
Metadata
Metadata
Assignees
Labels
No labels