Temporal Adjuster
Adjusters are a key tool for modifying temporal objects. They exist to externalize the process of adjustment, permitting different approaches, as per the strategy design pattern. Temporal Adjuster provides tools that help pinpoint very specific moments in time, without having to manually count days, weeks, or months. In essence, a Temporal Adjuster is a function that encapsulates a specific date/time manipulation rule. It operates on a temporal object (representing a date, time, or datetime) to produce a new temporal object adjusted according to the rule. Examples might be an adjuster that sets the date avoiding weekends, or one that sets the date to the last day of the month.
Installation
You can install Temporal Adjuster using pip:
pip install temporal-adjuster
Usage
This package provides a set of predefined temporal adjusters that can be used to adjust a temporal object in various ways. For example:
>>> from datetime import date, datetime
>>> from temporal_adjuster import TemporalAdjuster
>>> from temporal_adjuster.common.enums import Weekday
>>> TemporalAdjuster.first_day_of_next_week(date(2021, 1, 1))
datetime.date(2021, 1, 4)
>>> TemporalAdjuster.last_day_of_last_month(datetime(2021, 1, 1))
datetime.datetime(2020, 12, 31)
>>> TemporalAdjuster.first_of_year(Weekday.SATURDAY, date(2021, 1, 1))
datetime.date(2021, 1, 2)
>>> TemporalAdjuster.nth_of_month(Weekday.SUNDAY, datetime(2021, 5, 1), 2)
datetime.datetime(2021, 5, 9)
>>> TemporalAdjuster.next(Weekday.MONDAY, datetime(2021, 2, 11), 2)
datetime.datetime(2021, 2, 15)
Contributing
If you have any suggestions or improvements for this package, feel free to submit a pull request or open an issue on the GitHub repository as per the CONTRIBUTING document. We appreciate any feedback or contributions!
Metadata
Release files for temporal-adjuster 1.2.0
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 |
|---|---|---|---|---|
| temporal_adjuster-1.2.0.tar.gz | 13.9 kB | Without provenance | Details for temporal_adjuster-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| temporal_adjuster-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for temporal_adjuster-1.2.0-py3-none-any.whl |
Total release size: 32.9 kB
Release files / temporal_adjuster-1.2.0.tar.gz
| Download URL | temporal_adjuster-1.2.0.tar.gz |
|---|---|
| Size | 13.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2bfba810de8bc0140452844f92155ff47a29c877a6f027c4afa0985d538f6dd
|
|
BLAKE2b-256 checksum How to use checksums |
b327a287e0d7547640e638b59741f016855e812c5f809bbf97786564026667d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / temporal_adjuster-1.2.0-py3-none-any.whl
| Download URL | temporal_adjuster-1.2.0-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e821c1a40dd591276d7884e6bc0a3333c14a020a7bd3fb85947477cc5d06b19
|
|
BLAKE2b-256 checksum How to use checksums |
80b7c7024e3cd2fe6924c2294c3afaf346ea0217bf738e787699704861169d95
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for temporal-adjuster 1.2.0
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.