Get started with lunar-javascript CDN

MIT licensed

Lunar.js is a lightweight library for working with Jewish calendars in JS.

Tags:
  • calendar
  • lunar
  • solar
  • 节假日
  • 星座
  • 儒略日
  • 干支
  • 生肖
  • 节气
  • 节日
  • 彭祖百忌
  • 每日宜忌
  • 时辰宜忌
  • 吉神宜趋
  • 凶煞宜忌
  • 喜神
  • 福神
  • 财神
  • 阳贵神
  • 阴贵神
  • 胎神
  • 冲煞
  • 纳音
  • 星宿
  • 八字
  • 五行
  • 十神
  • 建除十二值星
  • 青龙名堂等十二神
  • 黄道黑道日

Stable version

Copied!

How to start using lunar-javascript CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with lunar-javascript CDN - cdnhub.io</title>
</head>
<body>
    <script src="https://cdn.cdnhub.io/lunar-javascript/1.6.11/lunar.js"></script>
    <script>
        // Create a Lunar instance with the current date
        const now = new Lunar();

        // Get the current lunar year, month, and day
        const year = now.year();
        const month = now.month();
        const day = now.day();

        // Output the current lunar date
        console.log(`Current lunar date: ${year}年${month}月${day}日`);

        // Calculate the lunar date for a specific date (e.g., January 1, 2023)
        const targetDate = new Date("2023-01-01");
        const targetLunar = new Lunar(targetDate);
        console.log(`Lunar date for January 1, 2023: ${targetLunar.year()}年${targetLunar.month()}月${targetLunar.day()}日`);
    </script>
</body>
</html>
Copied!
Copied!

All versions