yyyy_mm_dd
Easy string-based date manipulation library for Python
Installation
$ pip install yyyy_mm_dd
Why?
When writing some python code for a quick investigation in a notebook, do you also think it's a lot of boilerplate to work with dates? Do you always have to google the solution and copy it from stackoverflow because you never remember and just want the most quick and easy solution?
If you answered yes, then you are going to love this library. In yyyy_mm_dd you can work with strings directly, no need to convert back and forth, like to add +1 day to a date:
>>> from yyyy_mm_dd import *
>>> move_yyyy_mm_dd("2020-03-14", 1)
'2020-03-15'
There are many operations in the library that you can do with a single functions, no need to think on how to compose them, the most common operations should have a function available, for example the amount of days between two dates:
>>> diff_yyyy_mm_dd("2020-03-14", "2020-03-16")
2
Same operations can be done at various levels, and the name is easy to remember, just using the pattern of the date itself (operation + yyyy_mm, yyyy_mm_dd, yyyy_mm_dd_hh_mm_ss, etc). For example the difference in months between two dates:
>>> diff_yyyy_mm("2020-03", "2020-07")
4
>>> diff_yyyy_mm("2020-03-01", "2020-07-01")
4
Or to add a month:
>>> move_yyyy_mm("2020-03-14", 1)
'2020-04-14'
But not only strings, you can also pass a datetime as argument in case you already have it, and there is no need for any conversion:
>>> import datetime
>>> move_yyyy_mm_dd_hh(datetime.datetime(2020, 3, 14, 5, 0), 1)
datetime.datetime(2020, 3, 14, 6, 0)
Check the documentation to see all functions available, and if there is an operation you regularly need to do which is not there, please open an issue
TODO:
- Support timezones
- Make it fully compatible with RFC 3339
Contributing
Any contributions are very welcome. To run locally, install the dependencies:
pip install -r requirements.txt
The tests are inside the docs, to run them simply execute:
python -m doctest yyyy_mm_dd/__init__.py
If you want to check the type hints:
mypy yyyy_mm_dd
If you want to regenerate docs:
pdoc --html -o ./docs yyyy_mm_dd --force
Metadata
Release files for yyyy-mm-dd 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yyyy_mm_dd-0.1.2.tar.gz | 7.3 kB | Without provenance | Details for yyyy_mm_dd-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yyyy_mm_dd-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for yyyy_mm_dd-0.1.2-py3-none-any.whl |
Total release size: 13.5 kB
Release files / yyyy_mm_dd-0.1.2.tar.gz
| Download URL | yyyy_mm_dd-0.1.2.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
24187ae552945233535a5cd28a951023ddffc47f4c7c565510a265af10ee2ee9
|
|
BLAKE2b-256 checksum How to use checksums |
c566d1729a1eb399b9b5aedf7f047f9330fe950285008c423ac38974c99d52f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Release files / yyyy_mm_dd-0.1.2-py3-none-any.whl
| Download URL | yyyy_mm_dd-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1580e7bf860a5b0fc5d479c350e85a0733051d9b6a67379408d2f234ac77d0a8
|
|
BLAKE2b-256 checksum How to use checksums |
0d7f08e34d2663bc5b7c001e0c45b934e68e3fff76e91dcae5a862ec7c70d014
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5
|
Security for yyyy-mm-dd 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.