Rolldate is a new version of the last version of jquery mobile terminal time plug-in, which retains most of the functions of the last version, and adds callback function and theme style selection. The most important thing is to solve the remaining problems of the last version, such as relying on jquery, not smooth sliding, not reasonable parameter design and so on.

The reason for the development of date selection plug-ins is that there are not many date selection plug-ins based on the design of mobile terminal, and the date format supported by most of them is not rich enough and not flexible enough, which is undoubtedly insufficient in the changeable project requirements.

Rolldate rendering



Support for a variety of date formats, such as year, year, month, day, day, hour, minute, second, year, month, day, hour, minute, second, you can extend other formats, and through a series of callback functions, you can change the date to any format display, date determination, etc.

Due to the accumulation of the previous version, ROLLdate had a complete design scheme at the beginning of development. The following is the mind map design


The detailed parameters of the plugin are shown in the mind map above, which will not be explained here.

use

commonJs

var rolldate = require('rolldate');
new rolldate.Date({
  el:'#date'
})Copy the code

require.js

require(['rolldate'].function(rolldate){
  new rolldate.Date({
    el:'#date'})})Copy the code

Browser (Browser directly introduced)

new rolldate.Date({
  el:'#date'
})
Copy the code

Full call example

new rolldate.Date({
    el: '#date'.format: 'YYYY-MM-DD'.beginYear: 2000.endYear: 2100.theme: 'blue'.tapBefore: function(el) {
        console.log('Plugins start firing');
    },
    moveEnd: function(el, iscroll) {
        console.log('End of scroll');
    },
    confirmBefore: function(el, date) {
        console.log('Ok button trigger');
    },
    confirmEnd: function(el, date) {
        console.log('Plug-in finished running'); }})Copy the code

Demo address (qr code attached below) : rolldate, it is recommended to open it in mobile mode on PC

Download: github.com/weijhfly/ro…

If you find bugs or have better suggestions, let me know in the comments section below. Thank you.