japanese-holiday/japanese-holiday

v2.0.4 2018-12-28 13:51 UTC

This package is auto-updated.

Last update: 2019-11-20 14:02:42 UTC


README

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