lunar-date-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Lunar Date For Typescript

Overview

This lunar-date package provides class LunarDate and some utils function to convert solar date to lunar date Currently, the text of the 'animal' (can chi) of day, month, year are using Vietnamese.

Donate

If you feel my lib is useful, buy me a coffee, thanks! MoMo Wallet transfer QR code:

LunarDate class

Constructor function

  import { LunarDate } from 'lunar-date';
  const lunarDate = new LunarDate(1, 1, 2024);
  console.log(lunarDate.getLunarDay()); // 1
  console.log(lunarDate.getLunarMonth()); // 1
  console.log(lunarDate.getLunarFullYear()); // 2024
  console.log(lunarDate.getSolarDate()); // 10
  console.log(lunarDate.getSolarMonth()); // 2
  console.log(lunarDate.getSolarFullYear()); // 2024
  console.log(lunarDate.getAnimalDayName()); // Giáp Thìn
  console.log(lunarDate.getAnimalMonthName()); // Bính Dần
  console.log(lunarDate.getAnimalYearName()); // Giáp Thìn

Static function fromSolarDate:

import {LunarDate} from 'lunar-date';
const lunarDate = LunarDate.fromSolarDate(7, 5, 2024);

Package Sidebar

Install

npm i lunar-date-ts

Weekly Downloads

5

Version

1.0.0

License

MIT

Unpacked Size

268 kB

Total Files

35

Last publish

Collaborators

  • trantuan94