calendar library
soluna 月
bidirectional gregorian and chinese lunar calendar conversion for javascript. zero dependencies, one file, node.js and browser, 1900 to 2100.
convert
what it does
- 阴阳two-way conversion
gregorian to lunar and back, leap month aware, 1900 to 2100
- 八字four pillars
bazi from the real solar term boundary, not the gregorian month edge
- 时辰time periods
the twelve double-hours, with the 子 hour day boundary handled
- 节日festivals
public, buddhist, taoist and folk dates, plus 三娘煞日
- 月相moon and solar terms
moon phase and solar term returned with every conversion
- 一one file
zero dependencies; runs in node.js and in the browser
use it
install with npm install soluna, or copy soluna.js into your project.
// node.js
const { solarToLunar, lunarToSolar } = require('soluna');
// browser
<script src="soluna.js"></script>
const { solarToLunar, lunarToSolar } = window.Soluna;
solarToLunar(2024, 12, 28, 15, 30, 0); // gregorian to lunar
lunarToSolar(2012, 4, 7, false, 12, 0, 0); // lunar to gregorian (4th arg: leap month)