Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Relative weekday/date utilities useful for finding public holidays

Project Description

Relative weekday/date utilities useful for finding public holidays


pip install blackskirt

After installation is complete, try the following import statements to make sure it’s working.

from blackskirt import (WEEKDAY_MON, WEEKDAY_TUE, WEEKDAY_WED,
                        WEEKDAY_THU, WEEKDAY_FRI, WEEKDAY_SAT,
from blackskirt.ops import (mondayise, next_weekday, prev_weekday,
                            nearest_weekday, nth_weekday, last_weekday,
                            next_date, prev_date, nearest_date,)



  1. New Year’s Day: 1 January (or the following Monday if it falls on a Saturday or Sunday)
# 2011-01-01 is Saturday
assert mondayise(year=2011, month=1, day=1,
                 cases=((WEEKDAY_SAT, WEEKDAY_MON),
                        (WEEKDAY_SUN, WEEKDAY_MON),)) == "2011-01-03"
  1. Day after New Year’s Day: 2 January (or the following Monday if it falls on a Saturday, or the following Tuesday if it falls on a Sunday)
# 2011-01-02 is Sunday
assert mondayise(year=2011, month=1, day=2,
                 cases=((WEEKDAY_SAT, WEEKDAY_MON),
                        (WEEKDAY_SUN, WEEKDAY_TUE),)) == "2011-01-04"


Labour Day: The fourth Monday in October

assert nth_weekday(year=2014, month=10, n=4, weekday=WEEKDAY_MON) == "2014-10-27"


Marlborough provincial anniversary day: First Monday after Labour Day

assert next_weekday(year=2014, month=10, day=27, weekday=WEEKDAY_MON) == "2014-11-03"


Wellington provincial anniversary day: 22 January (Monday nearest to the actual day)

# 2014-01-22 is Wednesday
assert nearest_weekday(year=2014, month=1, day=22, weekday=WEEKDAY_MON) == "2014-01-20"


Memorial Day: Last Monday in May

assert last_weekday(year=2014, month=5, weekday=WEEKDAY_MON) == "2014-05-26"


Inauguration Day: First January 20 following a Presidential election

# 2012-11-06 was the previous presidential election day in US
assert next_date(month=1, day=20, offset=(2012, 11, 6)) == "2013-01-20"


All the code is licensed under the GNU Lesser General Public License (v3+).

Release History

Release History

This version
History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
Blackskirt-0.1.1.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Apr 15, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting