Coder Social home page Coder Social logo

wanghao221 / calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mumuy/calendar

0.0 0.0 0.0 445 KB

**万年历 - 阴阳历/农历公历换算工具/万年历组件_Chinese lunar calendar and Gregorian calendar conversion tool

Home Page: https://haiyong.site/tools/calendar/

License: MIT License

JavaScript 52.14% CSS 16.92% HTML 30.94%

calendar's Introduction

**农历公历换算算法

参考标准

算法根据《中华人民共和国国家标准GB/T33661—2017〈农历的编算和颁行〉》标准开发,明确了干支纪年和生肖纪年起于正月初一0点,与农历新年同步。

网页组件

<widget-calendar date="2023-01-01"></widget-calendar>
<widget-calendar>
    <div slot="item">
        <p>双鱼座</p>
    </div>    
</widget-calendar>

自定义事件-选中日期: onSelect

document.querySelector('widget-calendar').addEventListener('onSelect',function(event){
}

自定义事件-切换日期: onChange

document.querySelector('widget-calendar').addEventListener('onChange',function(event){
}

自定义事件-初始化: onInit

document.querySelector('widget-calendar').addEventListener('onInit',function(event){
}

方法调用

// 农历日期: 2022年(大致)闰四月初十
calendar.getDateByLunar(2022,4,10,true);

// 公历日期:2022年10月1日
calendar.getDateBySolar(2022,10,1);

// 今天
calendar.getToday();

返回结果

{
    "date":'2022-10-01',
    "sYear":2022,
    "sMonth":10,
    "sDay":1,
    "lYear":2022,
    "lMonth":9,
    "lDay":6,
    "isLeap":false,
    "lMonthZH":"九月",
    "lDayZH":"初六",
    "gzYearZH":"壬寅",
    "gzMonthZH":"己酉",
    "gzDayZH":"丁亥",
    "week":6,
    "weekZH":"星期六",
    "animal":"虎",
    "term":"",
    "zodiac":"天秤座",
    "festival":"国庆节"
}

calendar's People

Contributors

mumuy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.