Skip to main content

Date parsing for arbitrary strings!

Project description

arbitrary-dateparser

Parses arbitrary strings to get dates or ranges of dates (periods). Some of this behavior, such as whether it always returns periods, is configurable (for now, see the code) -- that defaults to true by the way.

Installation

pip install arbitrary-dateparser

Usage

>>> from arbitrary_dateparser import DateParser
>>> parser = DateParser()
>>> parser("jul 1 to jul 7")
<Period [2019-07-01T00:00:00+00:00 -> 2019-07-07T00:00:00+00:00]>
>>> parser("today")
<Period [2019-08-02T00:00:00-04:00 -> 2019-08-02T23:59:59.999999-04:00]>
>>> parser("last week to next friday")
<Period [2019-07-22T00:00:00-04:00 -> 2019-08-09T00:00:00-04:00]>

As mentioned, there are a few custom parameters you can pass to the parser, and a few things you can override that are set in __init__ to customize the behavior as well.

Contributing

  1. Fork it!

  2. Clone it!

    git clone https://github.com/<your-fork>/arbitrary-dateparser
    cd arbitrary-dateparser
    
  3. Install it!

    pip install -e .
    

    This tells pip to find setup.py in the current directory and install it in editable or development mode. Editable mode means that as you make changes to your local code, you’ll only need to re-install if you change the metadata about the project, such as its dependencies.

  4. Change it!

  5. Test it!

    # Assumes you're in the arbitrary-dateparser directory
    python -m tests.test_dateparser
    
  6. Submit a pull request!

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

arbitrary-dateparser-0.0.4.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

arbitrary_dateparser-0.0.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file arbitrary-dateparser-0.0.4.tar.gz.

File metadata

  • Download URL: arbitrary-dateparser-0.0.4.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for arbitrary-dateparser-0.0.4.tar.gz
Algorithm Hash digest
SHA256 5dd391cac084273a6ec5e5e51da629038ca8425b4b1930a3e6920f2922c75091
MD5 688bee44b7846e95d03a63006ebad343
BLAKE2b-256 5cf98bd150281178bc122ddcab6a2b6942cd193d391dabe860154f11735bef01

See more details on using hashes here.

File details

Details for the file arbitrary_dateparser-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: arbitrary_dateparser-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.7

File hashes

Hashes for arbitrary_dateparser-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1f29474becd90406c290f1ecc63088710438df108ee7c3d007d29418f1a23a13
MD5 7037d6cc8b4a611b3ab8ad24fc4cca8b
BLAKE2b-256 89c0cebf5d892eefd3f454c7f986dd35373775c05e42e83188851ca4ac72a898

See more details on using hashes here.

Supported by

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