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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dias_uteis-0.1.14-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dias_uteis-0.1.14.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.1 Windows/11

File hashes

Hashes for dias_uteis-0.1.14.tar.gz
Algorithm Hash digest
SHA256 75a5e2ae42f0fab1f7832c26b6950e63339079c6b3ec7dcd56dd5ae4889b092b
MD5 f8f14391db640352dccea3461f9070d0
BLAKE2b-256 d58ede5b54d41a275694a51038d195f2e6431b5c05d1a0be96d5552ecb99380d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dias_uteis-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.1 Windows/11

File hashes

Hashes for dias_uteis-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 efccaa93774c9c2db766bed38772d4f9e7aeec3d14e695d2c6e4064b6e6cc923
MD5 2ec737be30447f115966d8eb9d0e43e2
BLAKE2b-256 a241639a5825e12160d21b7a9c962feac896f88ebf04f57e9b170ce0df18dc2e

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