https://github.com/r32/lunar
农历/公历转换(1900~2100)
https://github.com/r32/lunar
lunar
Last synced: 3 months ago
JSON representation
农历/公历转换(1900~2100)
- Host: GitHub
- URL: https://github.com/r32/lunar
- Owner: R32
- Created: 2017-01-03T18:12:16.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-06-09T17:18:28.000Z (about 1 year ago)
- Last Synced: 2025-06-09T18:26:33.675Z (about 1 year ago)
- Topics: lunar
- Language: Haxe
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Lunar
-----
一个简单的农历/公历的转换
### Features
* 只提供简单的转换, 目前暂时不提供节气。
* 使用了整数缓存避免了每次都从 1900 年开始累加
### Usage
通过公历得到农历
```haxe
// 提供一个公历的 Date 值为参数
var lunar = Lunar.make(Date.now());
trace(lunar.toString());
```
通过农历获得公历
```haxe
// 最后的参数, 表示提供的月份是否为闰月, 如果你不清楚设 false 就好了
var lunar = Lunar.spec(2017, 1, 1, false);
// 返回 2017年大年初一 所对应公历 Date 值
trace(lunar.time);
```
### Issues
* 目前由于 hl 与 neko 平台的 Date 被限制在 1970~2038 之间, 因此这个范围之外的时间将出错