Skip to main content

Compute recurrences of events

Project description

This package provides helper functions to compute recurrences of events.

Copyright (c) 2013-2015 Michael Howitz

All Rights Reserved.

This software is subject to the provisions of the Zope Public License, Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. THIS SOFTWARE IS PROVIDED “AS IS” AND ANY AND ALL EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.

Usage

  • Register the package at the ZCA via ZCML:

    <include package="icemac.recurrence" />
  • Compute recurrences. The example computes the 2nd Tuesday each month.:

    >>> from icemac.recurrence.recurrence import get_recurrences
    >>> get_recurrences(
    ...     datetime=datetime(2015, 10, 13, 11, 15),
    ...     period='nth weekday of month',
    ...     interval_start=datetime(2015, 1, 1),
    ...     interval_end=datetime(2015, 12, 31))
    [datetime(2015, 10, 13, 11, 15),
     datetime(2015, 11, 10, 11, 15),
     datetime(2015, 12, 8, 11, 15)]
  • Supported recurrence periods:

    • daily

    • weekly

    • biweekly

    • nth weekday of month

    • nth weekday every other month

    • nth weekday from end of month

    • nth weekday from end of other month

    • yearly

Hacking

Source code

Get the source code:

$ hg clone https://bitbucket.org/icemac/icemac.recurrence

or fork me on: https://bitbucket.org/icemac/icemac.recurrence

Running the tests

To run the tests yourself call:

$ python2.7 bootstrap.py
$ bin/buildout -n
$ bin/py.test

Changelog

1.0.0 (2015-10-13)

  • Extract package from icemac.ab.calendar for reuse in other projects.

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

icemac.recurrence-1.0.0.tar.gz (8.9 kB view details)

Uploaded Source

File details

Details for the file icemac.recurrence-1.0.0.tar.gz.

File metadata

File hashes

Hashes for icemac.recurrence-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fdedc9004e0cb5da414c3576e0b4e39939e1456bd61e1f90acdb69f5a45f04d4
MD5 c6ea261c1075191842228514cb5fa53d
BLAKE2b-256 3bf1c6462d53383247ae7637b46df654add0433bb8961af8463f9c2aceff7368

See more details on using hashes here.

Supported by

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