Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/betodealmeida/magicdate
Convert fuzzy date to a datetime object.
https://github.com/betodealmeida/magicdate
Last synced: 16 days ago
JSON representation
Convert fuzzy date to a datetime object.
- Host: GitHub
- URL: https://github.com/betodealmeida/magicdate
- Owner: betodealmeida
- License: mit
- Created: 2017-12-01T01:39:20.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-06T18:16:24.000Z (almost 7 years ago)
- Last Synced: 2024-10-14T11:42:19.112Z (30 days ago)
- Language: Python
- Size: 9.77 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# magicdate
Convert fuzzy date to a datetime object.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 magicdateparser = 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`.