npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

solar2lunar

v2.0.5

Published

solar2lunar, lunar2solar

Readme

calendar

简单地将原有代码转换成了ES6规范,用于模块化导入使用。 经过原作者的同意,将代码推送到github。如需联系联系作者,见如下:

  • 1900-2100区间内的公历、农历互转
  • charset UTF-8
  • Author Jea杨([email protected])
  • Time 2014-7-21
  • Time 2016-8-13 Fixed 2033hex、Attribution Annals
  • Version 1.0.1
  • 公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
  • 农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]

EdgerOS 安装和使用

npm install @edgeros/solar2lunar

Node.js 环境安装

npm i solar2lunar
const calendar = require('@edgeros/solar2lunar')
// const { solar2lunar, solar2lunar } = require('solar2lunar')
calendar.solar2lunar(1987,11,01);

用法

// ES module
import calendar from 'solar2lunar'
// import { solar2lunar, solar2lunar } from 'solar2lunar'
calendar.solar2lunar(1987,11,01);

// commonjs
const calendar = require('solar2lunar')
// const { solar2lunar, solar2lunar } = require('solar2lunar')
calendar.solar2lunar(1987,11,01);

公历年月日转农历数据 返回json


calendar.solar2lunar(1987,11,01);

农历年月日转公历年月日


calendar.lunar2solar(1987,9,10);
  • 调用以上方法后返回类似如下object(json)
  • c开头的是公历各属性值
  • l开头的自然就是农历
  • gz开头的是天干地支纪年的数据
{
  Animal: "兔",
  IDayCn: "初十",
  IMonthCn: "九月",
  Term: null,
  astro: "天蝎座",
  cDay: 1,
  cMonth: 11,
  cYear: 1987,
  gzDay: "甲寅",
  gzMonth: "庚戌",
  gzYear: "丁卯",
  isLeap: false,
  isTerm: false,
  isToday: false,
  lDay: 10,
  lMonth: 9,
  lYear: 1987,
  nWeek: 7,
  ncWeek: "星期日"
}
  • 该代码还有其他可以调用的方法,请自己查看代码中的详细注释

  • 现在可以通过npm来使用calendar了

npm install solar2lunar
import calendar from 'solar2lunar'

calendar.solar2lunar(1987,11,01)