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).
Set
.package(url: "https://github.com/417-72KI/JapaneseHoliday.git", from: "1.2.1"),
in package dependencies and
"JapaneseHoliday",
in target dependencies.
import JapaneseHoliday
let holiday = JapaneseHoliday.holiday(ofDate: .now)
print("Today is \(holiday?.name ?? "not a 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")")