Skip to main content

Convert from fuzzy dates like “yesterday”, “2 weeks and 1 day ago”, “next wed”, “Jan 4”, etc., to a datetime object.

This is useful for processing command line arguments:

>>> from optparse import OptionParser
>>> import magicdate
>>> parser = OptionParser(option_class=magicdate.MagicDateOption)
>>> parser.add_option(
...     '-s', '--start', dest='start', type='magicdate', default=None)
>>> parser.add_option(
...     '-e', '--end', dest='end', type='magicdate', default='today')

Now you can pass options like “today”, “1996-01-01”, etc., to your program.

Inspired by Simon Willison’s dateparse.js.

Metadata

Release files for magicdate 0.2.2

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

Source distribution (sdist)

Source distribution for magicdate 0.2.2
File Size Uploaded Provenance Actions
magicdate-0.2.2.tar.gz 3.2 kB Without provenance Details for magicdate-0.2.2.tar.gz

Release files / magicdate-0.2.2.tar.gz

Download URL magicdate-0.2.2.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
256f196eb328f01310db536026c477bd3b81cf796ea5e2918d26afb17834a8de
BLAKE2b-256 checksum
How to use checksums
996893cc5ee8f323c7ca92ea51b50b0785f8b05912313220aa5fcb1767ee76ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for magicdate 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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