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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@maxtan/calendar

v1.0.0

Published

日历换算,公历转换成农历,回历,儒略日换算

Downloads

43

Readme

日历换算

支持公历转换成农历,回历

支持儒略日换算

支持生肖,年号,星座转换

安装

npm install @maxtan/calendar

或者使用 yarn:

yarn add @maxtan/calendar

使用

全部获取

import { getBaseDate } '@maxtan/calendar';
console.log(getBaseDate())  //获取当天的相关转换
console.log(getBaseDate(2021,9,13))  //获取2021年9月13日的相关转换

数据出参

{
  Ldi: 6, //日
  Ldc: '初七', //农历日
  cur_dz: 266, //距离当年冬至日期
  cur_xz: 84, //距离当年夏至日期
  cur_lq: 37, //距离当年立秋日期
  cur_mz: 100, //距离当年芒种日期
  cur_xs: 68, //距离当年小暑日期
  Lmc: '八', //农历月
  Ldn: 29, //农历当月天数,用于判断大小月
  Lleap: '',//如果为闰,则为闰年
  Lmc2: '九', //农历月别名
  Ljq: '',  // 节气
  jqsj: '', // 节气时间
  jqjd: -1, // 节气时间 -1 则当天不是节气日
  jqmc: '', // 节气名称
  Lyear: 37, // 甲子周期年
  Lyear0: 37, 
  Lyear2: '辛丑', // 农历年
  Lyear3: '辛丑',
  Lyear4: 4719, // 黄历年
  Lmonth: 9,
  Lmonth2: '丁酉', //黄历月名称
  Lday2: '甲子', //黄历日名称
  yxjd: -1, // 月相信息 -1 则不是特殊月相日
  yxmc: '', // 月相名称
  yxsj: '', // 月相时间
  Hday: 5, //回历日
  Hmonth: 2, //回历月
  Hyear: 1443 // 回历年
}

儒略日换算

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
lun.getJDCount(2021,9,13) //获取儒略日
lun.getJD2000Count(2021,9,13) //获取2000年儒略日

回历换算

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
const hlObj = lun.getHuiLi(lun.getJD2000Count(year, month, day));

农历换算

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
const lunarObj = lun.getLunarDate(year, month, day);

获取月相信息

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
const yxObj = lun.getYXInfo(year, month, day);

获取节气信息

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
const jqObj = lun.getJQInfo(year, month, day);

获取生肖信息

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
lun.getShX(year);

获取年号信息

import { Lunar } '@maxtan/calendar/lunar';
const lun = new Lunar();
lun.getNH(year);