Skip to content

feat(cron): add support for custom timezones#312

Merged
chrisguidry merged 3 commits intochrisguidry:mainfrom
omikader:main
Jan 30, 2026
Merged

feat(cron): add support for custom timezones#312
chrisguidry merged 3 commits intochrisguidry:mainfrom
omikader:main

Conversation

@omikader
Copy link
Contributor

The croniter library does support timezone-aware datetimes. Since _croniter is initialized with datetime.now(timezone.utc) as the base time, all cron expressions are interpreted in UTC. If you specify "0 9 * * *", that's 9:00 AM UTC, not your system timezone. By providing an optional timezone argument, we give the user the ability to customize which timezone should be used so they don't need to manually change the UTC time twice a year for daylight saving time.

@codecov-commenter
Copy link

codecov-commenter commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (f9c7d16) to head (6dc706f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #312   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files         102      102           
  Lines       10149    10161   +12     
  Branches      491      491           
=======================================
+ Hits        10012    10024   +12     
  Misses        121      121           
  Partials       16       16           
Flag Coverage Δ
python-3.10 98.65% <100.00%> (+<0.01%) ⬆️
python-3.11 97.30% <100.00%> (+<0.01%) ⬆️
python-3.12 98.65% <100.00%> (+<0.01%) ⬆️
python-3.13 98.65% <100.00%> (+<0.01%) ⬆️
python-3.14 98.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/docket/dependencies/_cron.py 100.00% <100.00%> (ø)
tests/fundamentals/test_cron.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@chrisguidry chrisguidry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops just missed the release, I got excited :D I'll cut another one after lunch :D

@chrisguidry
Copy link
Owner

Oops you'll probably want to do prek install to get the pre-commit hooks locally (or wherever your agent is running if you use one)

@chrisguidry chrisguidry merged commit b85c7d4 into chrisguidry:main Jan 30, 2026
36 of 37 checks passed
@purificant
Copy link

croniter library appear to be abandoned, read https://pypi.org/project/croniter/ it says:

UNMAINTAINED/ABANDONED CODE / DO NOT USE

Due to the new EU Cyber Resilience Act (as European Union), even if it was implied because there was no more activity, this repository is now explicitly declared unmaintained.

The content does not meet the new regulatory requirements and therefore cannot be deployed or distributed, especially in a European context.

This repository now remains online ONLY for public archiving, documentation and education purposes and we ask everyone to respect this.

As stated, the maintainers stopped development and therefore all support some time ago, and make this declaration on December 15, 2024.

We may also unpublish soon (as in the following monthes) any published ressources tied to this project (pypi, the repositories, …). So, please don’t rely on it after March 15, 2025 and adapt whatever project which used this code.

Is this not a concern for docket?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants