Giter Club home page Giter Club logo

rui-datepicker's Introduction

公农历日期选择器(rui-datepicker)

rui-datepicker是一款支持农历公历选择的原生插件。PC和移动端通用,支持公历农历切换,带时辰和不带时辰...

时间区间定死的1940-2-8至2030-12-31,如需调整可到代码里面自行修改。

使用方法

<!-- 在页面中引入js和css文件 -->
<link rel="stylesheet" href="./rui-datepicker.css">
<script src="./rui-datepicker.js"></script>

HTML结构及调用

<!-- 不带时辰 -->
<input id="demo1" type="text" data-toid-date="date" placeholder="日期选择不带时辰"  data-type="1" readonly="readonly" /></input>
<input type="hidden" id="date" name="date">

<!-- 带时辰 -->
<input id="demo2" type="text" data-toid-date="date1" data-toid-hour="hour1" data-hour="7" placeholder="日期选择带时辰" readonly="readonly"/>
<input type="hidden" id="date1" name="date">
<input type="hidden" id="hour1" name="hour">

<!-- 带时辰(提示确认)-->
<input id="demo3" type="text" data-confirm="true" data-toid-date="date1" data-toid-hour="hour1" data-hour="7" placeholder="日期选择带时辰" readonly="readonly"/>
<input type="hidden" id="date1" name="date">
<input type="hidden" id="hour1" name="hour">

<!-- 带时辰分钟 -->
<input id="demo4" type="text" data-confirm="true" data-toid-date="date3" data-toid-hour="hour3" data-toid-minute="minute3" name="input_date" data-hour="" placeholder="日期选择带时辰" readonly="readonly"/>
<input type="hidden" id="date3" name="date">
<input type="hidden" id="hour3" name="hour">
<input type="hidden" id="minute3" name="minute">

<!-- js -->
<script>
    var date1 = new ruiDatepicker().init('#demo1');
    var date2 = new ruiDatepicker().init('#demo2');
    var date3 = new ruiDatepicker().init('#demo3');
    var date4 = new ruiDatepicker().init('#demo4');
</script>

参数配置

  • 参数配置全部在HTML中,日期区间默认写死:1940-2-8至2030-12-31
//起始农历&公历:默认公历
data-type="0"   公历
data-type="1"   农历

//起始日期(公历):默认当前日期
data-date="2016-12-31"  

//确认日期后赋值隐藏表单日期ID(公历)
data-toid-date="inputDate"

//确认日期后赋值隐藏表单时辰ID(公历)
data-toid-hour="inputHour"

//确认日期后赋值隐藏表单年份ID(公历)
data-toid-year="inputYear"

//确认日期后赋值隐藏表单月份ID(公历)
data-toid-month="inputMonth"

//确认日期后赋值隐藏表单日期ID(公历)
data-toid-day="inputDay"

//起始时辰:默认0未知,该参数作用居于data-toid-hour为真
data-hour="3"  

//点击完成后,显示确认框(默认不显示)
data-confirm="true"      

rui-datepicker's People

Contributors

chenruifu avatar huanghlweb 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.