Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Avhz RustQuant Indonesia Calendar

From Leeroopedia


Knowledge Sources
Domains Calendar, Time_Value_of_Money
Last Updated 2026-02-07 19:00 GMT

Overview

Concrete tool for determining Indonesian national holidays for business day calculations provided by the RustQuant library.

Description

The Indonesia Calendar module implements the is_holiday_impl_indonesia function, which is the country-specific holiday detection backend for the Indonesian market within the Calendar system. When a Calendar is configured with Market::Indonesia, calls to is_holiday delegate to this function.

The function uses unpack_date to extract the year, month, day, weekday, ordinal day of the year, and Easter Monday offset. It then checks the date against the following Indonesian public holidays:

  • New Year's Day -- January 1 (fixed)
  • Ascension of the Prophet Muhammad (Isra Mi'raj) -- variable, lookup table from 2000 to 2024
  • Lunar New Year (Chinese New Year) -- variable (January/February), lookup table from 2000 to 2025
  • Hindu New Year (Nyepi) -- variable (March), lookup table from 2006 to 2024
  • Good Friday -- computed as Easter Monday minus 3 days
  • Eid-ul-Fitar (Idul Fitri) -- variable, extensive lookup table including multi-day observances and collective leave days
  • Labor Day -- May 1 (fixed)
  • Ascension Day of Jesus Christ -- computed as Easter Monday plus 38 days, with special overrides for 2007, 2008, and 2024
  • Vesak Day (Waisak) -- variable (May/June), lookup table from 2007 to 2025
  • Pancasila Day -- June 1 (fixed)
  • Eid-ul-Adha (Idul Adha) -- variable (June-August), lookup table from 2019 to 2025
  • Muharram (Islamic New Year) -- variable, lookup table from 2000 to 2025
  • Independence Day -- August 17 (fixed)
  • Birth of Prophet Muhammad (Maulid Nabi) -- variable, lookup table from 2006 to 2025
  • Christmas -- December 25 (fixed)
  • Boxing Day -- December 26 (fixed)

Each moveable holiday is implemented as a separate helper function using Rust matches! macro pattern matching against hardcoded (year, day, month) tuples. The Eid-ul-Fitar table is notably extensive, including both the official holiday dates and the additional collective leave (cuti bersama) days that Indonesia observes around the Eid period.

The module includes unit tests verifying weekend detection, public holiday detection for 2024, and regular business day identification.

Usage

Use this when you need to determine whether a given date is a business day on the Indonesian market calendar. This is typically used indirectly through the Calendar struct configured with Market::Indonesia.

Code Reference

Source Location

Signature

pub(crate) fn is_holiday_impl_indonesia(date: Date) -> bool;

fn is_ascension_day_of_prophet_muhammad(year: i32, day: u8, month: Month) -> bool;
fn is_lunar_new_year(year: i32, day: u8, month: Month) -> bool;
fn is_hindu_new_year(year: i32, day: u8, month: Month) -> bool;
fn is_eid_ul_fitar(year: i32, day: u8, month: Month) -> bool;
fn is_vesak_day(year: i32, day: u8, month: Month) -> bool;
fn is_eid_ul_adha(year: i32, day: u8, month: Month) -> bool;
fn is_muharram(year: i32, day: u8, month: Month) -> bool;
fn is_birth_of_prophet_muhammad(year: i32, day: u8, month: Month) -> bool;

Import

use RustQuant::time::calendar::{Calendar, Market};

// Used indirectly via:
let calendar = Calendar::new(Market::Indonesia);

I/O Contract

Inputs

Name Type Required Description
date Date Yes The date to check for an Indonesian public holiday

Outputs

Name Type Description
result bool true if the date is a recognized Indonesian public holiday, false otherwise

Usage Examples

use time::macros::date;
use RustQuant::time::calendar::{Calendar, Market};

let calendar = Calendar::new(Market::Indonesia);

// New Year's Day
let new_years = date!(2024-01-01);
assert!(!calendar.is_business_day(new_years));

// Independence Day (August 17)
let independence_day = date!(2024-08-17);
assert!(!calendar.is_business_day(independence_day));

// Eid-ul-Fitar 2024
let eid = date!(2024-04-08);
assert!(!calendar.is_business_day(eid));

// Pancasila Day (June 1)
let pancasila = date!(2024-06-01);
assert!(!calendar.is_business_day(pancasila));

// A regular business day
let regular_day = date!(2024-06-19);
assert!(calendar.is_business_day(regular_day));

// Weekends are not business days
let saturday = date!(2024-04-27);
assert!(!calendar.is_business_day(saturday));

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment