celestial-calendar

中文文档
1.1.0发布于 2026/11/03MITTypeScriptES Module构建来源已验证

Full-surface ESM alias for @0xf3cd/celestial

原始使用文档
文档目录5 节
  1. Install and Examples
  2. Today's Lunar Date
  3. Jieqi and UTC Date Fields
  4. Relationship to the Primary Package
  5. License

celestial-calendar

ESM alias package for @0xf3cd/celestial. It re-exports everything from the root entry and /date, including the TypeScript declarations, and depends on exactly the same version of the primary package. The alias copies no implementation and contains no WebAssembly module.

中文说明(@0xf3cd/celestial)

This guide describes the current source, including unreleased changes. Use the documentation matching your installed version. To use the current source, build the primary and alias packages from a full checkout and install both tarballs of the same version.

Install and Examples

Install it from npm in your application directory:

npm install celestial-calendar

Node 22 or newer is supported. Each JavaScript block below is a standalone ES module for example.mjs in your application directory; run it with node example.mjs from that directory.

Today's Lunar Date

Take the Gregorian date at fixed UTC+8 first, then convert it to a lunar date; do not pass a civil moment that carries fraction directly.

import * as celestial from "celestial-calendar";
import { dateToCivilAtOffset } from "celestial-calendar/date";

const eastEight = dateToCivilAtOffset(new Date(), 480);
const { year, month, day } = eastEight;
const gregorian = { year, month, day };

await celestial.init();
console.log("UTC+8 Gregorian date:", gregorian);
console.log("Lunar date:", celestial.lunar.fromGregorian("algo3", gregorian));

Jieqi and UTC Date Fields

The example below queries the UT1 moment of Lichun and, separately, the UTC civil fields of the current clock; no time-scale conversion connects the two outputs. The Jieqi momentUt1 is neither UTC nor a UTC+8 wall clock.

import * as celestial from "celestial-calendar";
import { dateToCivilUtc } from "celestial-calendar/date";

await celestial.init();
console.log(celestial.jieqi.moment(2026, celestial.Jieqi.LICHUN));
console.log(dateToCivilUtc(new Date()));

Relationship to the Primary Package

/date does not load WASM and needs no initialization; it only bridges civil fields in UTC or at a fixed offset, with no UTC/UT1/TT conversion. When both package names resolve to the same primary installation, they share export references and initialization state; this does not guarantee deduplication with mixed versions or arbitrary dependency graphs. For the API contract, the date basis of the lunar algorithms, and browser use, see the primary package guide. The package of the same name on PyPI is a separate Python distribution.

License

This alias's project-authored material is licensed under MIT; see LICENSE. For retained third-party material in the dependency, see @0xf3cd/celestial/THIRD_PARTY_NOTICES.txt in the installed primary package. That inventory belongs to the dependency and is not bundled in this alias.

版本与发布记录

celestial-calendar 共发布 5 个版本,首次发布于 2026/09/18;过去 12 个月发布了 5 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.1.0latest2026/11/03今天
1.0.02026/10/286 天前
0.9.02026/10/2014 天前
0.8.02026/10/1816 天前
0.7.02026/09/181 个月前

关于 celestial-calendar 的常见问题

celestial-calendar 是什么?

@0xf3cd/celestial的全表面ESM别名

如何安装 celestial-calendar?

在项目目录运行 npm install celestial-calendar,或使用 pnpm add / yarn add / bun add。

celestial-calendar 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

celestial-calendar 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

celestial-calendar 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

celestial-calendar 可以商用吗?

celestial-calendar 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

celestial-calendar 还在维护吗?

最新版本 1.1.0 发布于 2026/11/03(今天);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/09/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。