Skip to content

Add more calendars.  #142

Open
Open
@avhz

Description

This just involves going through each country and completing the following boilerplate (using some source such as timeanddate.com).

pub struct Argentina;

impl Calendar for Argentina {
    fn name(&self) -> &'static str {
        "Argentina"
    }

    fn country_code(&self) -> crate::iso::ISO_3166 {
        crate::iso::ARGENTINA
    }

    // Use the MIC code for the primary stock exchange of the country.
    fn market_identifier_code(&self) -> crate::iso::ISO_10383 {
        crate::iso::XBUE
    }

    fn is_business_day(&self, date: OffsetDateTime) -> bool {
        let (w, d, m, y, dd) = self.unpack_date(date);
        let em = Self::easter_monday(y as usize, false);

        if Self::is_weekend(date)
            || (d == 25 && m == Month::December)  // Christmas
            || (d == 1 && m == Month::January)    // New Years Day
             ...                                  // and so on...
        {
            return false;
        }

        true
    }
}

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

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions