get_next_payment_date_latam
Calculate the next valid payment date in Latin America, skipping weekends and public holidays. Supports rules like last working day of month for salary or invoice due dates.
Instructions
Calculates the next valid payment date for a given Latin American country, skipping weekends and national public holidays (fixed and moveable Easter-based). Supports rules: 'last_working_day_of_month' (salary payment in BR/AR), 'first_working_day_of_month', 'nth_working_day' (e.g. 5th working day for BR salary), 'next_working_day'. Returns { country, reference_date, rule, result_date }. Use when scheduling salary payments, NF-e/CFDI payment due dates, or any automated payment workflow that must avoid non-working days in LatAm.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country_code | Yes | Two-letter ISO country code. Example: 'BR', 'MX', 'CO' | |
| reference_date | Yes | Reference date in YYYY-MM-DD format. Example: '2026-01-31' | |
| rule | Yes | Payment rule to apply. | |
| n | No | For nth_working_day rule: which working day of the month. Example: 5 for 5th working day. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| country | No | ||
| reference_date | No | ||
| rule | No | ||
| n | No | ||
| result_date | No | ||
| error | No |