Skip to content

shuimo-design/lunar

Repository files navigation

@shuimo-design/lunar

农历转换工具

npm codecov

A Chinese lunar calendar conversion tool.

Usage

import { lunar } from '@shuimo-design/lunar';

const lunarDate = new lunar('2024-01-15 17:07:00');
/**
 *  response will be:
 *  {
 *    year: '癸卯',
 *    month: '乙丑',
 *    day: '戊寅',
 *    hour: '辛酉',
 *    minute: '初刻',
 *    term: undefined
 *  }
 */

term

import { lunar } from '@shuimo-design/lunar';

const lunarDate = new lunar('2023-3-6')

/**
 * response will be:
 * {
 *   year: '癸卯',
 *   month: '乙卯',
 *   day: '癸亥',
 *   hour: '壬子',
 *   minute: '正刻',
 *   term: '惊蛰'
 * }
 */

参考资料

日期转换 https://github.com/isee15/Lunar-Solar-Calendar-Converter

节气算法 https://github.com/OPN48/cnlunar

学习资料 https://ytliu0.github.io/ChineseCalendar/rules_simp.html

文献

陈久金. 中国古代时制研究及其换算[J]. 自然科学史研究, 1983 (2): 118-132.

Releases

No releases published

Packages

No packages published

Languages