jinja2-time
jinja2-time copied to clipboard
Impossible to format ISO-8601
When using your time filter, it's currently not possible to get the behavior of isoformat() method. Notice that strftime does not support getting ISO 8601; any attempt at reconstructing it fails, meaning the timezone offset is missing the colon in %z, example:
Correct: 2017-01-15T11:11:43+06:00 Incorrect: 2017-01-15T11:11:43+0600
Would you consider adding a special marker that would be a pass-through to calling isoformat() of arrow?
Alternatively, please provide access to Arrow's Tokens where 'ZZ' is used precisely for above (-07:00, -06:00 ... +06:00, +07:00)
Hi @slisznia! 👋
I'm happy to extend the functionality of jinja2-time, as long we we don't break the current API as it is used for https://github.com/audreyr/cookiecutter.
Any ideas how to expose isotime and a like in a good way?
OK, let's think about it. Arrow provides several formatting methods:
- strftime (the one you currently are calling)
- format (the one that supports ISO and other formats)
- humanize (this one permits things like "2 hours ago", etc)
So, the question is how can your package support invoking alternative formatters?. By default -- for backwards compatibility -- you want to call strftime, but allow developers to pick another formatter like 'format' or 'humanize' of Arrow. How about this: the 'now' tag selects strftime, then add 'now-humanize' and 'now-format' to pick the other two?
Per my PR #5, I think that arrow should be dropped entirely, though providing access to isoformat() or an alternative formatter doesn't seem like a bad idea.