Skip to main content

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


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.13.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

dias_uteis-0.1.13-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file dias_uteis-0.1.13.tar.gz.

File metadata

  • Download URL: dias_uteis-0.1.13.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

Hashes for dias_uteis-0.1.13.tar.gz
Algorithm Hash digest
SHA256 9db7de796d07c8ccdd0e87762f6915402a63aef03c95f2be3168c986ddde2c1b
MD5 98f7491921f62820c6aac4025418a9f9
BLAKE2b-256 d8d1e19f56d2838a892599c4fcebb545bf43218fda22b4757e687696c90c7592

See more details on using hashes here.

File details

Details for the file dias_uteis-0.1.13-py3-none-any.whl.

File metadata

  • Download URL: dias_uteis-0.1.13-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

Hashes for dias_uteis-0.1.13-py3-none-any.whl
Algorithm Hash digest
SHA256 7519fec7b28d81eede518ae38cbf91cc2541b008a8300af81416b0d5a2497960
MD5 2203864978bafc9bfe960a87fcc19d19
BLAKE2b-256 1eb551f4edbe6b490cfbb2ea16962271ad2dbc60dfd7b9103f1497931bbf2ee7

See more details on using hashes here.

Supported by

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