Skip to content

Add more calendars.  #142

Description

@avhz

This involves:

1: Adding a new Market enum variant in calendar.rs

Add either:

  • A new country (e.g. Australia).
  • Or an MIC code (e.g. XASX) if for a specific exchange.
pub enum Market {
    /// Null calendar.
    None,
    /// Weekend-only calendar.
    Weekends,

    /// Argentina national calendar.
    Argentina,
    /// Australia national calendar.
    Australia,
    ...
}

2: Implement the appropriate is_holiday_impl_* function

Add a new is_holiday_impl_* function in the appropriate file under countries/.

pub(crate) fn is_holiday_impl_australia(date: Date) -> bool {
    let (y, m, d, wd, yd, em) = unpack_date(date, false);

    if
    // New Year's Day (possibly moved to Monday)
    ((d == 1 || ((d == 2 || d == 3) && wd == Weekday::Monday)) && m == Month::January)
            // Australia Day, January 26th (possibly moved to Monday)
            || ((d == 26 || ((d == 27 || d == 28) && wd == Weekday::Monday)) && m == Month::January)
            ...
            // National Day of Mourning for Her Majesty, September 22 (only 2022)
            || (d == 22 && m == Month::September && y == 2022)
    {
        return true;
    }

    false
}

To-do:

  • Argentina
  • Australia
  • Austria
  • Botswana
  • Brazil
  • Canada
  • Chile
  • China
  • Czech Republic
  • Denmark
  • Finland
  • France
  • Germany
  • Hong Kong
  • Hungary
  • Iceland
  • India
  • Indonesia
  • Israel
  • Italy
  • Japan
  • Mexico
  • New Zealand
  • Norway
  • Poland
  • Romania
  • Russia
  • Saudi Arabia
  • Singapore
  • Slovakia
  • South Africa
  • South Korea
  • Sweden
  • Switzerland
  • Taiwan
  • Thailand
  • Turkey
  • Ukraine
  • United Kingdom
  • United States of America

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions