Utility for operate with working days.
Project description
Working Calendar
Description
Class WorkingCalendar
is utility for operate with working days.
Current version
0.0.1 (2018-07-13)
Installation
pip install working_calendar
Example
from datetime import date
from working_calendar import WorkingCalendar
if __name__ == '__main__':
wc = WorkingCalendar()
holidays = [
date(2018, 2, 23),
date(2018, 3, 8),
date(2018, 3, 9),
]
additional_working_days = [
date(2018, 3, 10),
]
not_standard_working_day = (date(2018, 3, 10), 240) # 240 min = 4 hours
wc.extend_holidays(holidays)
wc.extend_working_days(additional_working_days)
wc.update_not_standard_working_day(not_standard_working_day[0], not_standard_working_day[1])
print(wc.count_working_days_between(date(2018, 3, 1), date(2018, 3, 12))) # 7 working days
print(wc.count_working_days_in_year(2018)) # 259 working days
print(wc.count_working_days_in_month(2018, 2)) # 19 working days
print(wc.count_working_minutes_between(date(2018, 3, 1), date(2018, 3, 12))) # 3120 minutes
print(wc.count_working_minutes_in_year(2018)) # 124080 minutes
print(wc.count_working_minutes_in_month(2018, 2)) # 9120 minutes
print(wc.count_working_hours_between(date(2018, 3, 1), date(2018, 3, 12))) # 52.0 hours
print(wc.count_working_hours_in_year(2018)) # 2068.0 hours
print(wc.count_working_hours_in_month(2018, 2)) # 152.0 hours
print(wc.get_next_working_day(date(2018, 3, 7))) # 2018-03-10
print(wc.skip_working_days(date(2018, 3, 10), 10)) # 2018-03-23
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
working_calendar-0.0.1.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for working_calendar-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48999ea66ef12b9f9af0746425ff8bb54b0c542c776d7f6f0569dd810785e6b6 |
|
MD5 | a240fff31f5efc543804e9ca36e318cd |
|
BLAKE2b-256 | 757abe41a95b8f28aab6f8052f7912f049f22e6176ec0e41845c15445d213524 |