temporal-adjuster


Nametemporal-adjuster JSON
Version 1.2.0 PyPI version JSON
download
home_pageNone
SummaryAdjusters 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.
upload_time2024-06-20 17:10:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.3
licenseMIT License
keywords date time datetime adjuster adjustment temporal
VCS
bugtrack_url
requirements numpy python-dateutil
Travis-CI No Travis.
coveralls test coverage
            <center>

# Temporal Adjuster

<p align="center">

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.

</p>

[![PyPI status](https://img.shields.io/pypi/status/temporal-adjuster.svg)](https://pypi.python.org/pypi/temporal-adjuster/)
[![Package Version](https://shields.io/pypi/v/temporal_adjuster)](https://pypi.org/project/temporal_adjuster/)
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/temporal-adjuster)](https://pypi.org/project/temporal-adjuster/)
[![Downloads Per Month](https://shields.io/pypi/dm/temporal_adjuster)](https://pypistats.org/packages/temporal_adjuster)
![Libraries.io dependency status for Github repo](https://img.shields.io/librariesio/github/gtkacz/temporal_adjusters_py)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)

[![CI](https://github.com/gtkacz/temporal_adjusters_py/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/gtkacz/temporal_adjusters_py/actions/workflows/CI.yml)
[![codecov](https://codecov.io/github/gtkacz/temporal_adjusters_py/graph/badge.svg?token=WFJE0GHSZM)](https://codecov.io/github/gtkacz/temporal_adjusters_py)
[![Documentation Status](https://readthedocs.org/projects/temporal-adjusters-py/badge/?version=latest)](http://temporal-adjusters-py.readthedocs.io/?badge=latest)
[![Github commits](https://badgen.net/github/commits/gtkacz/temporal_adjusters_py)](https://Github.com/gtkacz/temporal_adjusters_py/commit/)
[![Github latest commit](https://badgen.net/github/last-commit/gtkacz/temporal_adjusters_py)](https://Github.com/gtkacz/temporal_adjusters_py/commit/)
![Github code size in bytes](https://img.shields.io/github/languages/code-size/gtkacz/temporal_adjusters_py)
![Github repo file or directory count](https://img.shields.io/github/directory-file-count/gtkacz/temporal_adjusters_py)

[![Github stars](https://badgen.net/github/stars/gtkacz/temporal_adjusters_py)](https://Github.com/gtkacz/temporal_adjusters_py/stargazers/)
[![Github watchers](https://badgen.net/github/watchers/gtkacz/temporal_adjusters_py/)](https://Github.com/gtkacz/temporal_adjusters_py/watchers/)
[![Github issues](https://img.shields.io/github/issues/gtkacz/temporal_adjusters_py.svg)](https://Github.com/gtkacz/temporal_adjusters_py/issues/)
[![Github issues-closed](https://img.shields.io/github/issues-closed/gtkacz/temporal_adjusters_py.svg)](https://Github.com/gtkacz/temporal_adjusters_py/issues?q=is%3Aissue+is%3Aclosed)
[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/gtkacz/temporal_adjusters_py.svg)](http://isitmaintained.com/project/gtkacz/temporal_adjusters_py "Average time to resolve an issue")
[![Percentage of issues still open](http://isitmaintained.com/badge/open/gtkacz/temporal_adjusters_py.svg)](http://isitmaintained.com/project/gtkacz/temporal_adjusters_py "Percentage of issues still open")
[![Github pull-requests](https://img.shields.io/github/issues-pr/gtkacz/temporal_adjusters_py.svg)](https://Github.com/gtkacz/temporal_adjusters_py/pull/)
<!-- [![Github contributors](https://img.shields.io/github/contributors/gtkacz/temporal_adjusters_py/badges.svg)](https://Github.com/gtkacz/temporal_adjusters_py/badges/graphs/contributors/) -->

</center>

## Installation

You can install Temporal Adjuster using pip:

```sh
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:

```py
>>> 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](https://github.com/gtkacz/temporal_adjusters_py) as per the CONTRIBUTING document. We appreciate any feedback or contributions!


<!-- [![Stargazers over time](https://starchart.cc/gtkacz/temporal_adjusters_py.svg)](https://starchart.cc/gtkacz/temporal_adjusters_py)
[![Contributors over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=gtkacz/temporal_adjusters_py)](https://www.apiseven.com/en/contributor-graph?chart=contributorOverTime&repo=gtkacz/temporal_adjusters_py) -->

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "temporal-adjuster",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.3",
    "maintainer_email": "Gabriel Mitelman Tkacz <gmtkacz@proton.me>",
    "keywords": "date, time, datetime, adjuster, adjustment, temporal",
    "author": null,
    "author_email": "Gabriel Mitelman Tkacz <gmtkacz@proton.me>",
    "download_url": "https://files.pythonhosted.org/packages/b3/27/a287e0d7547640e638b59741f016855e812c5f809bbf97786564026667d2/temporal_adjuster-1.2.0.tar.gz",
    "platform": null,
    "description": "<center>\r\n\r\n# Temporal Adjuster\r\n\r\n<p align=\"center\">\r\n\r\nAdjusters 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.\r\n\r\n</p>\r\n\r\n[![PyPI status](https://img.shields.io/pypi/status/temporal-adjuster.svg)](https://pypi.python.org/pypi/temporal-adjuster/)\r\n[![Package Version](https://shields.io/pypi/v/temporal_adjuster)](https://pypi.org/project/temporal_adjuster/)\r\n[![Supported Python Versions](https://img.shields.io/pypi/pyversions/temporal-adjuster)](https://pypi.org/project/temporal-adjuster/)\r\n[![Downloads Per Month](https://shields.io/pypi/dm/temporal_adjuster)](https://pypistats.org/packages/temporal_adjuster)\r\n![Libraries.io dependency status for Github repo](https://img.shields.io/librariesio/github/gtkacz/temporal_adjusters_py)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\r\n\r\n[![CI](https://github.com/gtkacz/temporal_adjusters_py/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/gtkacz/temporal_adjusters_py/actions/workflows/CI.yml)\r\n[![codecov](https://codecov.io/github/gtkacz/temporal_adjusters_py/graph/badge.svg?token=WFJE0GHSZM)](https://codecov.io/github/gtkacz/temporal_adjusters_py)\r\n[![Documentation Status](https://readthedocs.org/projects/temporal-adjusters-py/badge/?version=latest)](http://temporal-adjusters-py.readthedocs.io/?badge=latest)\r\n[![Github commits](https://badgen.net/github/commits/gtkacz/temporal_adjusters_py)](https://Github.com/gtkacz/temporal_adjusters_py/commit/)\r\n[![Github latest commit](https://badgen.net/github/last-commit/gtkacz/temporal_adjusters_py)](https://Github.com/gtkacz/temporal_adjusters_py/commit/)\r\n![Github code size in bytes](https://img.shields.io/github/languages/code-size/gtkacz/temporal_adjusters_py)\r\n![Github repo file or directory count](https://img.shields.io/github/directory-file-count/gtkacz/temporal_adjusters_py)\r\n\r\n[![Github stars](https://badgen.net/github/stars/gtkacz/temporal_adjusters_py)](https://Github.com/gtkacz/temporal_adjusters_py/stargazers/)\r\n[![Github watchers](https://badgen.net/github/watchers/gtkacz/temporal_adjusters_py/)](https://Github.com/gtkacz/temporal_adjusters_py/watchers/)\r\n[![Github issues](https://img.shields.io/github/issues/gtkacz/temporal_adjusters_py.svg)](https://Github.com/gtkacz/temporal_adjusters_py/issues/)\r\n[![Github issues-closed](https://img.shields.io/github/issues-closed/gtkacz/temporal_adjusters_py.svg)](https://Github.com/gtkacz/temporal_adjusters_py/issues?q=is%3Aissue+is%3Aclosed)\r\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/gtkacz/temporal_adjusters_py.svg)](http://isitmaintained.com/project/gtkacz/temporal_adjusters_py \"Average time to resolve an issue\")\r\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/gtkacz/temporal_adjusters_py.svg)](http://isitmaintained.com/project/gtkacz/temporal_adjusters_py \"Percentage of issues still open\")\r\n[![Github pull-requests](https://img.shields.io/github/issues-pr/gtkacz/temporal_adjusters_py.svg)](https://Github.com/gtkacz/temporal_adjusters_py/pull/)\r\n<!-- [![Github contributors](https://img.shields.io/github/contributors/gtkacz/temporal_adjusters_py/badges.svg)](https://Github.com/gtkacz/temporal_adjusters_py/badges/graphs/contributors/) -->\r\n\r\n</center>\r\n\r\n## Installation\r\n\r\nYou can install Temporal Adjuster using pip:\r\n\r\n```sh\r\npip install temporal-adjuster\r\n```\r\n\r\n## Usage\r\n\r\nThis package provides a set of predefined temporal adjusters that can be used to adjust a temporal object in various ways. For example:\r\n\r\n```py\r\n>>> from datetime import date, datetime\r\n\r\n>>> from temporal_adjuster import TemporalAdjuster\r\n>>> from temporal_adjuster.common.enums import Weekday\r\n\r\n>>> TemporalAdjuster.first_day_of_next_week(date(2021, 1, 1))\r\ndatetime.date(2021, 1, 4)\r\n\r\n>>> TemporalAdjuster.last_day_of_last_month(datetime(2021, 1, 1))\r\ndatetime.datetime(2020, 12, 31)\r\n\r\n>>> TemporalAdjuster.first_of_year(Weekday.SATURDAY, date(2021, 1, 1))\r\ndatetime.date(2021, 1, 2)\r\n\r\n>>> TemporalAdjuster.nth_of_month(Weekday.SUNDAY, datetime(2021, 5, 1), 2)\r\ndatetime.datetime(2021, 5, 9)\r\n\r\n>>> TemporalAdjuster.next(Weekday.MONDAY, datetime(2021, 2, 11), 2)\r\ndatetime.datetime(2021, 2, 15)\r\n```\r\n\r\n## Contributing\r\n\r\nIf you have any suggestions or improvements for this package, feel free to submit a pull request or open an issue on the [GitHub repository](https://github.com/gtkacz/temporal_adjusters_py) as per the CONTRIBUTING document. We appreciate any feedback or contributions!\r\n\r\n\r\n<!-- [![Stargazers over time](https://starchart.cc/gtkacz/temporal_adjusters_py.svg)](https://starchart.cc/gtkacz/temporal_adjusters_py)\r\n[![Contributors over time](https://contributor-graph-api.apiseven.com/contributors-svg?chart=contributorOverTime&repo=gtkacz/temporal_adjusters_py)](https://www.apiseven.com/en/contributor-graph?chart=contributorOverTime&repo=gtkacz/temporal_adjusters_py) -->\r\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "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.",
    "version": "1.2.0",
    "project_urls": {
        "Issues": "https://github.com/gtkacz/temporal_adjusters_py/issues",
        "Repository": "https://github.com/gtkacz/temporal_adjusters_py.git"
    },
    "split_keywords": [
        "date",
        " time",
        " datetime",
        " adjuster",
        " adjustment",
        " temporal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80b7c7024e3cd2fe6924c2294c3afaf346ea0217bf738e787699704861169d95",
                "md5": "7f071db1759214bc5103d993a7db205a",
                "sha256": "5e821c1a40dd591276d7884e6bc0a3333c14a020a7bd3fb85947477cc5d06b19"
            },
            "downloads": -1,
            "filename": "temporal_adjuster-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f071db1759214bc5103d993a7db205a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.3",
            "size": 19001,
            "upload_time": "2024-06-20T17:10:23",
            "upload_time_iso_8601": "2024-06-20T17:10:23.002803Z",
            "url": "https://files.pythonhosted.org/packages/80/b7/c7024e3cd2fe6924c2294c3afaf346ea0217bf738e787699704861169d95/temporal_adjuster-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b327a287e0d7547640e638b59741f016855e812c5f809bbf97786564026667d2",
                "md5": "e8622653c4b2d31f5340780e832a325c",
                "sha256": "a2bfba810de8bc0140452844f92155ff47a29c877a6f027c4afa0985d538f6dd"
            },
            "downloads": -1,
            "filename": "temporal_adjuster-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e8622653c4b2d31f5340780e832a325c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.3",
            "size": 13862,
            "upload_time": "2024-06-20T17:10:24",
            "upload_time_iso_8601": "2024-06-20T17:10:24.864697Z",
            "url": "https://files.pythonhosted.org/packages/b3/27/a287e0d7547640e638b59741f016855e812c5f809bbf97786564026667d2/temporal_adjuster-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-20 17:10:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gtkacz",
    "github_project": "temporal_adjusters_py",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "python-dateutil",
            "specs": []
        }
    ],
    "lcname": "temporal-adjuster"
}
        
Elapsed time: 0.57545s