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

fortel-solar-term

v1.0.0

Published

[![npm version](https://img.shields.io/npm/v/fortel-solar-term.svg)](https://www.npmjs.com/package/fortel-solar-term) [![node](https://img.shields.io/node/v/fortel-solar-term.svg)](https://www.npmjs.com/package/fortel-solar-term) [![Build](https://travi

Downloads

6

Readme

fortel-solar-term

npm version node Build Codecov branch

GitHub issues GitHub forks GitHub stars GitHub License dependencies Status devDependencies Status

This node.js module is a library for some Chinese Astrology 24 terms.(24節氣) 這是一個關於24節氣的nodejs library. 能在時間與節氣年份月份之間換算。

Project page

Wiki pages for Chinese Astrology:


Install

$ npm install --save fortel-solar-term

API & Samples

remarks:

  • 年份的定義為該年的立春直至下年的立春
  • 月份的定義為以節氣計算的月份 (e.g: 1月 = 立春直至驚蟄之間)
  • 換算會有約在5分鍾以內的誤差

估算該年月份的開始及完結時間

API:

new TermYearMonth(year, month).getRange();

input:

  • year: 以節氣計的年份
  • month: 節氣月份

output:

  • format: { start: xxx, end: xxx }
  • start: 節氣月份的開始時間 (moment object)
  • end: 節氣月份的開始時間 (moment object)

remarks:

  • 這個年份的定義為該年的立春直至下年的立春
  • 這個月份的定義為以節氣計算的月份 (e.g: 1月 = 立春直至驚蟄之間)
  • Expected error within 5 min

code:

const fortelSolarTerm = require('fortel-solar-term');
let { TermDatetime, TermYearMonth } = fortelSolarTerm;

// 2019年1月
let {start, end} = new TermYearMonth(2019, 1).getRange();
console.log(`start: ${start.toLocaleString()}`);
console.log(`end: ${end.toLocaleString()}`);

output:

start: Mon Feb 04 2019 11:11:22 GMT+0800
end: Wed Mar 06 2019 05:06:35 GMT+0800

估算某時間所屬的節氣月份

API:

new TermDatetime(datetime).getYearTermMonth();

input:

  • datetime: moment object or moment object constructor parameter (single parameter)

output:

  • format: { termYear: 2019, termMonth: 1 }
  • termYear: 以節氣計算所屬的年份
  • termMonth: 以節氣計算所屬的月份

code:

const fortelSolarTerm = require('fortel-solar-term');
const moment = require('moment');
let { TermDatetime, TermYearMonth } = fortelSolarTerm;

// 2019年1月
console.log(new TermDatetime(moment.parseZone("2019-02-04T11:00:00+08:00")).getYearTermMonth());

output:

TermYearMonth { termYear: 2018, termMonth: 12 }

Author Contact