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

lunar-info

v1.0.0

Published

This package provides a convenient way to retrieve lunar information for specific dates and access holiday information.

Downloads

36

Readme

lunar-info

This package provides a convenient way to retrieve lunar information for specific dates and access holiday information.

Installation

npm install lunar-info

Usage

import {getLunar, getHolidaysThisYear, getLunarHolidaysThisYear} from 'lunar-info';

// Example 1: Get Lunar Information for a Date
const lunarInfo = getLunar(2018, 12, 1);
console.log(lunarInfo);

// Example 2: Get Holidays for the Current Year [1900,2099]
const holidays = getHolidaysThisYear(new Date().getFullYear());
console.log(holidays);

// Example 3: Get Lunar Holidays for the 2008 Year [1900,2099] 2008 is lunar year
const lunarHolidays = getLunarHolidaysThisYear(2008);
console.log(lunarHolidays);

API Reference

getLunar(year: number, month: number, day: number): object

Get lunar information for a specific date.

Parameters:

  • year: A number representing the year of the desired date. Must be in the range from 1900 to 2099.
  • month: A number representing the month of the desired date. Must be in the range from 1 to 12.
  • day: A number representing the day of the desired date. The valid range depends on the specific lunar month and year.

Returns: An object containing the lunar information for the provided date, including:

  • yang_y: number; // 阳历年 【2023】
  • yang_m: number; // 阳历月 【5】
  • yang_d: number; // 阳历日 【1】
  • yang_yyyymmdd: string; // 阳历 【20230501】
  • yin_y: number; // 阴历年 【2023】
  • yin_m: number; // 阴历月 【3】
  • yin_d: number; // 阴历日 【12】
  • run_yin_m: number; // 本年闰月的月份 【0】 0 代表当年无闰月 1-12 为当年的闰月阴历月
  • yin_m_name: string; // 阴历月份对应的汉字 【三月】
  • yin_d_name: string; // 阴历日期对应的汉字 【十二】
  • yin_gz_y: string; // 阴历 干支年 【癸卯】
  • yin_gz_m: string; // 阴历 干支月 【丙辰】
  • yin_gz_d: string; // 阴历 干支日 【己未】
  • shu: string; // 阴历 属 【兔】
  • week: string; // 星期 汉字 【星期一】
  • week_index: number; // 星期 数字 【1】 0 表示星期日,1 表示星期一,以此类推
  • week_number: number; // 当前是第几周 【22】
  • xing_zuo: string; // 星座 【金牛】
  • yin_jie_ri: string; // 阴历节日
  • yang_jie_ri: string; // 阳历节日 【劳动节】
  • jie_qi: string; // 24 节气 【小雪】 | ""
  • compute_jie_ri: string; // 计算的节日 【父亲节】 | ‘’
  • y: string; // j: 【-】
  • j: string; // y: 【诸事不宜】
  • ... (other relevant lunar information)

getHolidaysThisYear(year: number): object

Parameters:

  • year: A number representing the year of the desired date. Must be in the range from 1900 to 2099.

Returns:

  • 0101: '元旦';
  • 0214: '情人节';
  • 0308: '妇女节';
  • 0312: '植树节';
  • 0401: '愚人节';
  • 0501: '劳动节';
  • 0504: '青年节';
  • 0601: '儿童节';
  • 0701: '建党日';
  • 0801: '建军节';
  • 0910: '教师节';
  • 1001: '国庆节';
  • 1031: '万圣夜';
  • 1101: '万圣节';
  • 1111: '光棍节';
  • 1224: '平安夜';
  • 1225: '圣诞节';
  • '母亲节'
  • '父亲节'
  • '感恩节'

getLunarHolidaysThisYear(year: number): object

Parameters:

  • year: A number representing the year of the desired date. Must be in the range from 1900 to 2099.

Returns:

  • 0101: '春节';
  • 0115: '元宵节';
  • 0202: '龙抬头';
  • 0303: '上巳节';
  • 0505: '端午节';
  • 0624: '火把节';
  • 0707: '七夕';
  • 0715: '中元节';
  • 0815: '中秋节';
  • 0909: '重阳节';
  • 1001: '寒衣节';
  • 1015: '下元节';
  • 1208: '腊八节';
  • 1223: '北小年';
  • 1224: '南小年';
  • '除夕'
  • '清明'