Convert fuzzy date to a datetime object.
Project description
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magicdate-0.1.3.tar.gz.
File metadata
- Download URL: magicdate-0.1.3.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e34fc6febb4d65bde607b43dc8d446984a38751a0f45581e42369747e60faf6
|
|
| MD5 |
eda76e2bac96f0a7dbfc341f7ec50de8
|
|
| BLAKE2b-256 |
2490128f2cb8f4562038f68e986ff0c667ce81fb1977ad613cf3adc2c6ebf94b
|
File details
Details for the file magicdate-0.1.3-py2.5.egg.
File metadata
- Download URL: magicdate-0.1.3-py2.5.egg
- Upload date:
- Size: 5.6 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4e54f2c6a8f85de0b5235f9b803db2702fc19de61714835981ead193d1095e0
|
|
| MD5 |
1ee0f5439d4a364750c9a293d7cc64fe
|
|
| BLAKE2b-256 |
0a24be8978dfab0ef8e8edf5be7d8437674508ff2a4c6dadfd415ecf83a975f5
|