Skip to content

417-72KI/JapaneseHoliday

Repository files navigation

JapaneseHoliday

Actions Status GitHub release Swift Package Manager GitHub license

A library for calculating Japanese holidays.

It crawls the official website of the Japanese government and extracts the data of the holidays.

See also https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html

Note

Date caculation is based on Japanese Standard Time (JST).

Installation

Set

.package(url: "https://github.com/417-72KI/JapaneseHoliday.git", from: "1.2.1"),

in package dependencies and

"JapaneseHoliday",

in target dependencies.

Usage

import JapaneseHoliday

let holiday = JapaneseHoliday.holiday(ofDate: .now)

print("Today is \(holiday?.name ?? "not a holiday")")

Add a custom holiday

import JapaneseHoliday

JapaneseHoliday.addCustomHoliday(forMonth: 1, day: 2, named: "三が日")
JapaneseHoliday.addCustomHoliday(forMonth: 1, day: 3, named: "三が日")

let holiday = JapaneseHoliday.holiday(ofDate: Date(timeIntervalSince1970: 1735743600)) // 2025-01-02 00:00:00 GMT+9
print("2025-01-02 is \(holiday?.name ?? "not a holiday")")

Author

417-72KI

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •