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.
If you feel my lib is useful, buy me a coffee, thanks! MoMo Wallet transfer QR code:
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
import {LunarDate} from 'lunar-date';
const lunarDate = LunarDate.fromSolarDate(7, 5, 2024);