Python module to convert an ISO date/time into a range
Project description
README
This project contains a library which converts an ISO date/time string into a range.
Usage
The module contains one function - get_date_range
- which converts a given ISO
date/time string into a range and returns this range as a list. It is used as
follows:
import isodaterange
range = isodaterange.get_date_range("2019-07")
# returns [datetime.datetime(2019, 7, 1, 0, 0, 0), datetime.datetime(2019, 7, 31, 23, 59, 59)]
range = isodaterange.get_date_range("2019-04-01/2019-06-23")
# returns [datetime.datetime(2019, 4, 1, 0, 0, 0), datetime.datetime(2019, 6, 23, 23, 59, 59)]
range = isodaterange.get_date_range("P1Y")
# returns [now, date one year from now]
Testing
There is a tests
module which contains unit tests. This can be run as follows:
python3 -m unittest isodaterange.tests
License
(c) UK Research and Innovation (UKRI), 2019 - 2020, British Antarctic Survey. You may use and re-use this software and associated documentation files free of charge in any format or medium, under the terms of the Open Government Licence v3.0. You may obtain a copy of the Open Government Licence at http://www.nationalarchives.gov.uk/doc/open-government-licence/
Project details
Release history Release notifications | RSS feed
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
Hashes for isodaterange-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5d6a8b9448f65dc3ede89160f1496e69a27b66236c9513dfec1dddd95d34eef |
|
MD5 | c95cd177ba67bb905099ab3eb0795ab7 |
|
BLAKE2b-256 | 7ec7d597e98574157f612f4c0b4a6019c4a71bcaa90befd0643c3a5d7953fb65 |