Lektor plugin to help with dates and times
Project description
Introduction
This is a plugin for Lektor which provides some helpers for dealing with dates and times.
Currently this provides a dateordatetime model field type which can contain either a date or a datetime.
Also the following jinja filters are provided:
- isoformat(dt)
Returns an iso formatted version the datetime, with timezone information. If dt is naive, it is localized to the site’s default timezone.
- localize_datetime(dt)
If dt is naive, it is localized to the site’s default timezone.
Changelog
Release 0.2 (2017-08-04)
New features
Make lists of dateordatetime types sortable
The dateordatetime custom Lektor type now returns subclasses of datetime.date or datetime.datetime which can be compared against one another. Normally, attempts to compare a date against a datetime results in a TypeError being raised. This made it difficult to sort on dateordatetime values.
Now dates sort before any datetimes with the same date. Naïve datetimes sort before timezone-aware datetimes with the same date.
Release 0.1 (2017-04-19)
Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for lektor-datetime-helpers-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 091d80c58250081795f2c3d8e6de982ce268140882fa3b2473d4b7b9da01b862 |
|
MD5 | 920bcf7f15b419422f9a28125659d6a0 |
|
BLAKE2b-256 | 581474e5e56453d16c7d20f68c5cd64da6fb32647f4db548089582b1a11d9937 |
Hashes for lektor_datetime_helpers-0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09d6f86756618a8906004209247fe7c79f24dfcd27243b6168f77510d92d10a1 |
|
MD5 | 1c6882de87f63aeff82a0dd3bfc0c027 |
|
BLAKE2b-256 | eabb3e7e001f3538dd512e9ccff143de9eda244ada09486c909a6c36e6e7ca5a |