Code Monkey home page Code Monkey logo

python-bizdatetime's Introduction

ABOUT
=====

python-bizdatetime is a simple library for performing business day arithmetic.


KNOWN LIMITATIONS
=================

Rotating weekends/holidays are not supported (e.g., two days working, third day
off).

Business hour arithmetic is not (yet) supported.


DEFINITIONS
===========

Weekend
    Weekly repeating non-business day. Weekend does not have to be at the end
    (or beginning) or the week. Weekends do not have to be consecutive days.

Holiday
    Like weekend, holiday is a non-business day. Unlike weekend, holiday does
    not have weekly regularity. It is just a date. Holiday can coincide with
    weekend.

Policy
    Is a (possibly empty) collection of holidays and holidays. All calculations
    are performed within a policy.


SAMPLE USAGE
============

All business day arithmetic is performed in the context of policy::
    
    from bizdatetime import *
    from datetime import date
    policy = Policy(weekends=(SAT, SUN), holidays=(date(2011,7,1),))
    day = date(2011, 6, 29) # Wednesday
    print policy.add(day, 2) # add 2 business dates -> Monday after the long weekend
    print policy.biz_day_delta(date(2011, 7, 4), date(2011, 6, 30)) # one holiday, one weekend between

The output of the above program will be::

    datetime.date(2011, 7, 4)
    1

Policy method docstrings contain more examples.

python-bizdatetime's People

Contributors

shelldweller avatar

Watchers

James Cloos avatar Philippe Ombredanne avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.