Ferramentas para cálculos de dias úteis no calendário brasileiro.
Project description
dias_uteis
Biblioteca feita para facilitar o uso e cálculos de dias úteis no calendário brasileiro.
- Sem dependências externas.
- Testado em todas versões do Python a partir da versão 3.6.
- Fácil uso, API simples.
- Extremamente leve.
Instalação
pip install dias_uteis
Uso
import datetime
import dias_uteis as dus
>>> dus.last_du()
datetime.date(2023, 11, 7)
>>> dus.next_du()
datetime.date(2023, 11, 9)
>>> date = datetime.date(2023, 11, 8)
>>> dus.is_du(date)
True
>>> corpus_christi_2020 = datetime.date(2020, 6, 11) # Corpus Christi 2020
>>> dus.is_holiday(corpus_christi_2020)
True
>>> dus.delta_du(date, 5) # Soma 5 dias úteis
datetime.date(2023, 11, 16)
>>> dus.delta_du(date, -2) # Subtrai 2 dias úteis
datetime.date(2023, 11, 6)
>>> a = datetime.date(2023,11,6)
>>> b = datetime.date(2023,11,16)
>>> dus.diff_du(a, b)
7
>>> start = datetime.date(2023, 10, 20)
>>> end = datetime.date(2023, 11, 7)
>>> dus.du_range(start, end)
[datetime.date(2023, 10, 20), datetime.date(2023, 10, 23), datetime.date(2023, 10, 24),
datetime.date(2023, 10, 25), datetime.date(2023, 10, 26), datetime.date(2023, 10, 27),
datetime.date(2023, 10, 30), datetime.date(2023, 10, 31), datetime.date(2023, 11, 1),
datetime.date(2023, 11, 3), datetime.date(2023, 11, 6)]
>>> dus.year_holidays(2023) # Lista todos feriados de 2023
[datetime.date(2023, 1, 1), datetime.date(2023, 2, 20), datetime.date(2023, 2, 21),
datetime.date(2023, 4, 7), datetime.date(2023, 4, 21), datetime.date(2023, 5, 1),
datetime.date(2023, 6, 8), datetime.date(2023, 9, 7), datetime.date(2023, 10, 12),
datetime.date(2023, 11, 2), datetime.date(2023, 11, 15), datetime.date(2023, 12, 25)]
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
dias_uteis-0.1.12.tar.gz
(6.6 kB
view details)
Built Distribution
File details
Details for the file dias_uteis-0.1.12.tar.gz
.
File metadata
- Download URL: dias_uteis-0.1.12.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e51f8df658b976e7a9ae63252f3cb7bf578bc457ef6eb2863cac46db88d4a1c |
|
MD5 | db9f95d215ea340d76c060b93ea84702 |
|
BLAKE2b-256 | e604c15961eb9d0525877c40143c49d2b7b222a00f6554b504141747ccf6917b |
File details
Details for the file dias_uteis-0.1.12-py3-none-any.whl
.
File metadata
- Download URL: dias_uteis-0.1.12-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.7 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a29f2039c4fc204cb77f6b258bfb8475e1225a8bcb4741b8fbde2e2dff9c23c5 |
|
MD5 | d91cf386585a2f4ebddbba5ee80d3313 |
|
BLAKE2b-256 | cf3e01232c292be0438bd76754105c1bc6e80955f95f0ca80c5b498c2699700a |