Skip to main content

Dates and intervals

Project description

dateme

Dates and intervals

Build Status codecov License PyPI

Overview

A recurrence / scheduling engine: pure datetime math that, given a schedule (a frequency in an IANA timezone, plus optional calendar overlays, a makeup strategy, and start/end bounds), computes when a recurring event fires. Written in Rust with bindings for Python (pyo3) and JavaScript (WebAssembly).

A schedule is described as JSON:

{
  "freq": { "type": "weekly", "days": ["mon"], "time": "17:30" },
  "timezone": "America/New_York",
  "overlays": [{ "calendar": "nyse_holiday", "rule": "exclude" }],
  "makeup": "after",
  "start": null,
  "end": null
}

Every binding exposes the same five queries over a Schedule:

  • next(after=now) / previous(before=now) — the single next/previous occurrence.
  • until(before, after=now) — the ascending series in (after, before); until(end)[0] == next().
  • since(after, before=now) — the descending series in (after, before); since(start)[0] == previous().
  • upcoming(n, after=now) — the next n occurrences.

Python

from datetime import datetime, timezone
from dateme import Schedule

s = Schedule(spec_json)             # JSON string, dict, or a typed model object
s.validate()
s.next(datetime(2026, 1, 13, tzinfo=timezone.utc))   # -> aware datetime | None
s.upcoming(3)                                        # defaults to now

Or build the schedule from typed objects instead of JSON:

from dateme import Schedule, model as m
from dateme import Weekly, Overlay, Makeup, CalendarId, OverlayRule, Weekday

s = Schedule(m.Schedule(
    freq=Weekly([Weekday.MON], "17:30"),
    timezone="America/New_York",
    overlays=[Overlay(CalendarId.NYSE_HOLIDAY, OverlayRule.EXCLUDE)],
    makeup=Makeup.AFTER,
))

JavaScript

import init, { Schedule } from "dateme";

await init(); // load the wasm module once
const s = new Schedule(spec);              // string or object
s.next(new Date("2026-01-13T00:00:00Z"));  // -> Date | null
s.upcoming(3);                             // defaults to now

Supported frequencies: hourly, daily, weekly, monthly_by_day (fixed day or last), monthly_by_weekday (nth / last weekday), and yearly. Overlays filter occurrences against built-in calendars (us_federal_holiday, us_business_day, nyse_holiday, nyse_trading_day, backed by finance-dates); makeup shifts a dropped occurrence to the nearest surviving day (before / after), or drops it (none). DST gaps and overlaps are resolved on conversion to UTC.

[!NOTE] This library was generated using copier from the Base Python Project Template repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dateme-0.1.0.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dateme-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.28+ x86-64

dateme-0.1.0-cp310-abi3-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10+Windows x86-64

dateme-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file dateme-0.1.0.tar.gz.

File metadata

  • Download URL: dateme-0.1.0.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for dateme-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d0748c012c7fb62fa46f2262fd58123a0436d4e2825fe111546ed1cdb08171e3
MD5 bae9151355a890efa563c85548edbe12
BLAKE2b-256 9ee30bf108e8eceb224b0356f6d1c33935974226706e273b13501e271c34600f

See more details on using hashes here.

File details

Details for the file dateme-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for dateme-0.1.0-cp311-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8a37e7228868b20bb31d9fe002a4b549060369356b15c1bbb54bdf5d4d1b8d38
MD5 66e1ff9181bf0f998e269853e6ea8cbd
BLAKE2b-256 5441c653b4c1ca454f73cdf2f77126e3fc2aa96b5269a55e29ce47528e18a8ef

See more details on using hashes here.

File details

Details for the file dateme-0.1.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: dateme-0.1.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for dateme-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8c1a164e78421823bd0a2545b16f583a13967d18b303d8f9daf6742437aca705
MD5 ae304bf7c71ee1376aed7f3f38bc6c5f
BLAKE2b-256 62fe521b9b2349bd02f62d02b93c54aba2b20729660c11c76c7ceede0dc4517a

See more details on using hashes here.

File details

Details for the file dateme-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for dateme-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bfbf29f3cce9aa27448337e45dee909e18a26828f6ff7243850d3ec4e7388f52
MD5 b96cde57d049e5c1a42db2542f42e510
BLAKE2b-256 80e5fb871133e062fd11991e17e90baaabd55321298888bf646c25456468143f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page