Skip to main content

Helpers for Dealing with datetimes in Lektor

PyPI version PyPI Supported Python Versions GitHub license GitHub Actions (Tests)

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 1.0.1 (2021-12-22)

Packaging

  • Set Requires-Python: >=3.6 in METADATA

  • Deleted setup.py

Testing

  • Add work-around for lektor bug #974

  • Test under python 3.10, and lektor<3.3

Release 1.0.0 (2021-08-16 — yanked)

This release drops support for Python 2 and Python 3.5.

This release has been yanked from PyPI due to missing Requires-Python in METADATA allowing (broken) installation under py27. Use release 1.0.1 instead.

Dependencies

This package no longer has any external dependencies. Since python 3.6, datetime.astimezone() has the ability to interpret a naïve datetime w.r.t. the system local timezone, so the use of tzlocal is no longer necessary.

Release 0.3.3.post1 (2021-08-16)

  • Fix useless comparison in test.

  • Fix formatting in CHANGES.rst.

Release 0.3.3 (2021-08-15)

Bugs

  • Pin tzlocal<3. (Tzlocal >= 3 drops support for python 2.)

Release 0.3.2 (2020-11-19)

Bugs

  • Ensure that comparable_date and comparable_datetime objects are hashable. This fixes issues using these classes with pytz under py3k.

Testing

  • Test under py3.9

Release 0.3.1 (2020-05-21)

This release freshens the packaging. There are no substantive changes to the code in this release.

Packaging

  • Update packaging to PEP 517.

  • Update LICENSE to latest 3-clause BSD text.

Docstrings

  • Fix docstring syntax. No substantive changes.

Tests

  • Test under python 3.7 and 3.8.

  • Use twine check rather than setup.py check to test description syntax.

Release 0.3 (2018-01-18)

Fix things so that date and datetime types returned by the dateordatetime Lektor type are comparable against None. (None compares less than all other dates and datetimes.)

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.

Metadata

Release files for lektor-datetime-helpers 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lektor-datetime-helpers 1.0.1
File Size Uploaded
lektor-datetime-helpers-1.0.1.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lektor-datetime-helpers 1.0.1
File Interpreter ABI Platform
lektor_datetime_helpers-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / lektor-datetime-helpers-1.0.1.tar.gz

Download URL lektor-datetime-helpers-1.0.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
99f0524ca6dcf9bde0999516bb3c7fbae822c8827c71602ef18e55debcefdad7
BLAKE2b-256 checksum
How to use checksums
6c387f28aef9be06cceb4124bb314c191c5a328f5209beedea8d34f079915eed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release files / lektor_datetime_helpers-1.0.1-py3-none-any.whl

Download URL lektor_datetime_helpers-1.0.1-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23c8e17166b1cf6e094e0a197e1f2475c4f887713b9d8781ed009ab56769b08d
BLAKE2b-256 checksum
How to use checksums
e5a6c5fa935c0b803f1e7fddb56c272063d05481a792caf9d72483b99c71b3cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3

2 release files

0.2

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page