This is a small python package that wraps useful extension helper methods around the standard library datetime
package.
$ pip install datemore
This package extends date
and datetime
objects with useful methods for:
- Localizing
date
anddatetime
objects - Adding and subtracting
- Generating date ranges
- Mocking (you cannot mock builtins, so why not use this library in the first place 😉)
Example:
import datemore.date
sunday = datemore.date.Date(2020, 2, 2)
tuesday = sunday.add_days(2)
passed_days = sunday.range_to(tuesday)
tuesday.native() # Get the native datetime.date object
Do you want to add new extensions? Go ahead! Contributions are welcome, have a look at CONTRIBUTING.
For detailed instructions see CONTRIBUTING.
You can run tests with
$ invoke test
$ invoke test --min-coverage=90 # Fail when code coverage is below 90%
$ invoke type-check # Run mypy type checks
Lint and format the code with
$ invoke format
$ invoke lint
All of this happens when you run invoke pre-commit
.
This project is still in the alpha stage and should not be considered production ready.