11

GitHub - lodenrogue/bank-holidays: Java library for determining whether a given...

 2 years ago
source link: https://github.com/lodenrogue/bank-holidays
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Bank Holidays

Java library for determining whether a given day is a bank holiday

Usage

LocalDate newYears = LocalDate.of(2022, 1, 1);
Bank bank = USBankFactory.createBank();
boolean isHoliday = bank.isHoliday(newYears);

Using an Existing Bank

// This bank comes packaged with the Federal Reserve Bank holidays 
Bank bank = USBankFactory.createBank();

Creating a Holiday

The Holiday interface can be used to create a new Holiday

class NewHoliday implements Holiday {
    
    @Override
    public boolean isHoliday(LocalDate day) {
        // Your logic for determining if 
        // the given day is a holiday goes here
        // ...
    }
}

Creating a New Bank

List<Holiday> holidays = List.of(aHoliday, anotherHoliday);
Bank bank = new Bank(holidays);

Existing Holidays

  • USChristmas
  • USColumbusDay
  • USIndependenceDay
  • USJuneteenth
  • USLaborDay
  • USMartinLutherKingDay
  • USMemorialDay
  • USNewYearsDay
  • USPresidentsDay
  • USThanksgiving
  • USVeteransDay

Contributing

Please feel free to submit a pull request with new holidays and banks


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK