Liking cljdoc? Tell your friends :D

brazilian-utils.date.core

Utilities for working with Brazilian dates and holidays.

Provides functions to:

  • Retrieve national holidays
  • Check if a date is a holiday
  • Get holiday names
  • Work with Brazilian calendar information
Utilities for working with Brazilian dates and holidays.

Provides functions to:
  - Retrieve national holidays
  - Check if a date is a holiday
  - Get holiday names
  - Work with Brazilian calendar information
raw docstring

brazilian->iso-dateclj/s

source

get-holiday-nameclj/s

(get-holiday-name date)

Gets the name of a holiday for a given date.

Args: date (string): Date in ISO format (YYYY-MM-DD) or Brazilian format (DD/MM/YYYY)

Returns: The name of the holiday as a string, or nil if not a holiday or invalid format

Examples: (get-holiday-name "2024-12-25") ;; "Natal" (get-holiday-name "25/12/2024") ;; "Natal" (Brazilian format) (get-holiday-name "2024-01-15") ;; nil (get-holiday-name "invalid") ;; nil

Gets the name of a holiday for a given date.

Args:
  date (string): Date in ISO format (YYYY-MM-DD) or Brazilian format (DD/MM/YYYY)
  
Returns:
  The name of the holiday as a string, or nil if not a holiday or invalid format
  
Examples:
  (get-holiday-name "2024-12-25") ;; "Natal"
  (get-holiday-name "25/12/2024") ;; "Natal" (Brazilian format)
  (get-holiday-name "2024-01-15") ;; nil
  (get-holiday-name "invalid") ;; nil
sourceraw docstring

get-holidaysclj/s

(get-holidays year)

Retrieves all national holidays for a given year from Brasil API.

Args: year (int or string): The year to fetch holidays for

Returns: A map with the response. On success: {:status 200, :body [{:date "YYYY-MM-DD", :name "Holiday Name"}]} On error: {:error "error message"}

Examples: (get-holidays 2024) (get-holidays "2024")

Retrieves all national holidays for a given year from Brasil API.

Args:
  year (int or string): The year to fetch holidays for
  
Returns:
  A map with the response. On success:
    {:status 200, :body [{:date "YYYY-MM-DD", :name "Holiday Name"}]}
  On error:
    {:error "error message"}
    
Examples:
  (get-holidays 2024)
  (get-holidays "2024")
sourceraw docstring

is-holiday?clj/s

(is-holiday? date)

Checks if a given date is a national holiday.

Args: date (string): Date in ISO format (YYYY-MM-DD) or Brazilian format (DD/MM/YYYY)

Returns: true if the date is a national holiday, false otherwise Returns false on invalid format or network errors

Examples: (is-holiday? "2024-12-25") ;; true (Christmas) (is-holiday? "25/12/2024") ;; true (Christmas - Brazilian format) (is-holiday? "01/01/2024") ;; true (New Year - Brazilian format) (is-holiday? "2024-01-15") ;; false (is-holiday? "invalid") ;; false (is-holiday? nil) ;; false

Checks if a given date is a national holiday.

Args:
  date (string): Date in ISO format (YYYY-MM-DD) or Brazilian format (DD/MM/YYYY)
  
Returns:
  true if the date is a national holiday, false otherwise
  Returns false on invalid format or network errors
  
Examples:
  (is-holiday? "2024-12-25") ;; true (Christmas)
  (is-holiday? "25/12/2024") ;; true (Christmas - Brazilian format)
  (is-holiday? "01/01/2024") ;; true (New Year - Brazilian format)
  (is-holiday? "2024-01-15") ;; false
  (is-holiday? "invalid") ;; false
  (is-holiday? nil) ;; false
sourceraw docstring

iso->brazilian-dateclj/s

source

normalize-dateclj/s

source

valid-brazilian-date-format?clj/s

source

valid-date-format?clj/s

source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close