Skip to main content

A simple utility for calculating business time aware timedeltas between two datetimes

Project description

businesstime

https://badge.fury.io/py/businesstime.png https://travis-ci.org/seatgeek/businesstime.png?branch=master

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.

>>> datetime(2013, 12, 26, 5) - datetime(2013, 12, 23, 12)
datetime.timedelta(2, 61200)
>>> bt = businesstime.BusinessTime(holidays=businesstime.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.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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

businesstime-0.1.6.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

businesstime-0.1.6-py2-none-any.whl (6.9 kB view hashes)

Uploaded Python 2

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page