1.0.0 • Published 1 year ago

lunar-date-ts v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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);
1.0.0

1 year ago