from_format('12/2/2015 12:00:00 AM EST', 'M/D/YYYY h:mm:ss A zz')
See original GitHub issue>>> pendulum.from_format('12/2/2015 12:00:00 AM EST', 'M/D/YYYY h:mm:ss A zz')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/nackjicholson/Library/Caches/pypoetry/virtualenvs/source-data-service-py3.6/lib/python3.6/site-packages/pendulum/__init__.py", line 256, in from_format
parts = _formatter.parse(string, fmt, now(), locale=locale)
File "/Users/nackjicholson/Library/Caches/pypoetry/virtualenvs/source-data-service-py3.6/lib/python3.6/site-packages/pendulum/formatting/formatter.py", line 400, in parse
lambda m: self._replace_tokens(m.group(0), locale), escaped_fmt
File "/Users/nackjicholson/Library/Caches/pypoetry/virtualenvs/source-data-service-py3.6/lib/python3.6/site-packages/pendulum/formatting/formatter.py", line 400, in <lambda>
lambda m: self._replace_tokens(m.group(0), locale), escaped_fmt
File "/Users/nackjicholson/Library/Caches/pypoetry/virtualenvs/source-data-service-py3.6/lib/python3.6/site-packages/pendulum/formatting/formatter.py", line 651, in _replace_tokens
raise ValueError("Unsupported token: {}".format(token))
ValueError: Unsupported token: zz
This is from the master branch. The zz
is in the documentation, I feel like it should work.
The from_format
functionality is very important to my usage of pendulum. I’d like to find some time to dig in and see if I can help make it better but I could use some guidance. Do you have any idea why it has been unreliable? Is there some other approach that you might want to take in order to improve it?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:9
- Comments:6 (3 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Some abbreviations are present in the regular
pendulum.timezones
list (in other words,z
).But that list seems lacking enough for the US, let alone with a less US-centric view, to be not particularly useful.
I’m not sure there’s a general solution to this as I don’t believe the abbreviations are well defined enough to be unique. Still, they certainly are used and the ambiguity could be overcome by allowing the caller to pass a mapping of unique abbreviations to unique names.
{'CDT': 'America/Chicago'}
(hopefully that’s a good example but…) Optionally, regional default lists could be provided for easy use.I agree that it is accurate for this issue to be in the open state. I don’t have authority to make the fix happen and I have lots of other open source work I am more responsible for that needs my time. Sorry.
:[
(nitpick, this issue is three years old, not two)