Amlich
Amlich 是一个 Swift 包,它提供了一个从阳历到阴历以及反之的接口。
使用
将 import Amlich
放在源代码顶部
将阳历日期转换为阴历日期
let solarDate = SolarDate(day: 1, month: 1, year: 2020)
let timeZone: Double = +7
print(Amlich.toLunar(of: solarDate, with: timeZone))
// or
print(solarDate.toLunar(with: timeZone))
将阴历日期转换为阳历日期
let lunarDate = LunarDate(day: 1, month: 1, year: 2020, isLeap: false)
let timeZone: Double = +7
print(Amlich.toSolar(of: lunarDate, with: timeZone))
// or
print(lunarDate.toSolar(with: timeZone))
获取阳历日期对应的节气
let solarDate = SolarDate(day: 1, month: 1, year: 2020)
let hour = (hh: 10, mm: 20)
let timeZone: Double = +7
SolarTerm.of(solar: solarDate, in: hour, with: timeZone)
安装
- 在
Package.swift
文件的dependencies
中添加.package(url: "https://github.com/anhmv/Amlich.git", from: "1.0.0")
。 - 使用
$ swift package update
更新您的包。
帮助、反馈或建议?
- 如果您想对版本进行修改,请通过 创建一个 PR。
- 有关讨论、新闻和公告,请联系 @mvanh91 on Twitter。