Skip to main content
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description: businesstime
============

.. image:: https://badge.fury.io/py/businesstime.png
:target: http://badge.fury.io/py/businesstime

.. image:: https://travis-ci.org/seatgeek/businesstime.png?branch=master
:target: https://travis-ci.org/seatgeek/businesstime

BusinessTime is a simple utility for calculating business time aware timedeltas between two datetimes. BusinessTime's understanding of weekends, holidays and business hours can be easily configured in code.

.. code-block:: pycon

>>> datetime(2013, 12, 26, 5) - datetime(2013, 12, 23, 12)
datetime.timedelta(2, 61200)
>>> bt = businesstime.BusinessTime(holidays=businesstime.holidays.usa.USFederalHolidays())
>>> bt.businesstimedelta(datetime(2013, 12, 23, 12), datetime(2013, 12, 26, 5))
datetime.timedelta(1, 18000)

Features
--------

- Simple, pythonic, business-time-aware datetime math
- A simple declarative format for defining holidays
- A number of useful iterators/predicate functions related to holidays/weekends/business hours


0.3.0
=====
* Fix a bug (#25) where holidays were not properly detected when later dates were tested before earlier ones, thanks @agans
* Fix a bug (#13) where time deltas were calculated incorrectly when both start and end times are after business hours, thanks @airsource
* `businesstime_hours` now returns a `timedelta` rather than a numeric value (#23), thanks @naes17
* `businesstimedelta` now returns negative timedeltas when the start time is after the end time (#19), thanks @jeremyklein
* Add 2017-2018 public holidays for Queensland/Brisbane Australia (#17), thanks @danc86

0.2.1
=====
* Fix broken pypi package (#14), thanks @tarkatronic

0.2.0
=====
* Change package layout: country-specific holidays are stored in files named w/ their ISO 3166-1 alpha-3 country codes
* Add 2013-2016 public holidays for Queensland/Brisbane Australia (#11), from @danc86
* Fix AttributeError when no holidays are specified (#10), from @danc86

0.1.6
=====
* Handle US federal holidays that fall on the weekend but are observed on Friday/Monday (#8)

0.1.5
=====
* Fixed a bug (#7) where a datetime after business hours and a datetime during business hours were handled incorrectly

0.1.4
=====
* Fixed a bug (#6) where two datetimes on the same day but before business hours were handled incorrectly

0.1.3
=====
* Fixed a bug (#3) where the first instant of a business day was not considered part of that day

0.1.2
=====
* Fix changelog

0.1.1
=====
* Fix pypi package

0.1.0
=====
* Public Release

Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2.7

Metadata

Release files for businesstime 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for businesstime 0.3.0
File Size Uploaded Provenance Actions
businesstime-0.3.0.tar.gz 8.5 kB Without provenance Details for businesstime-0.3.0.tar.gz

Release files / businesstime-0.3.0.tar.gz

Download URL businesstime-0.3.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4fadde6eb74b5d649d07cdb77f05c68f7e27fa0b70934e3ba9cc1b416c8f0ad6
BLAKE2b-256 checksum
How to use checksums
8cd8b72c2a07b5a24918948c6d97c1b1ddd01e151564b6d226caf525beeefc19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for businesstime 0.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page