Skip to content

77web/Japanese.Holiday

Repository files navigation

Build Status

Japanese.Holiday

calculates holidays in Japan.

Installation

composer install japanese-holiday/japanese-holiday

Usage

Get list of holidays for a year

<?php
use Japanese\Holiday\Repository as HolidayRepository;

$holidayRepository = new HolidayRepository();
$holidays = $holidayRepository->getHolidaysForYear(2017);
$holidays['2017-01-01']->getDate(); // equals new \DateTime('2016-01-01')
$holidays['2017-01-01']->getName(); // "元旦"

Check whether a date is a holiday or not

<?php
use Japanese\Holiday\Repository as HolidayRepository;

$holidayRepository = new HolidayRepository();
$holidayRepository->isHoliday('2017-01-01'); // true
$holidayRepository->isHoliday('2017-01-04'); // false

Build new yml for a specific year

php scripts/newyear.php XXXX