1.0.1 • Published 2 years ago

rollable-datepicker v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

rolldate-full npm npm

This plugin is a new version of rolldate (jquery-date). It is mainly used to solve the problem that the previous version of the parameter design is not reasonable, the sliding efficiency is not high, it depends on jquery, there is no optional theme style, and the callback function is added to make the plugin more flexible.

Usage

es6

import Rolldate from 'rolldate'
new Rolldate({
  el:'#date'
})

commonJS

var Rolldate = require('rolldate');
new Rolldate({
  el:'#date'
})

amd

require(['rolldate'],function(Rolldate){
  new Rolldate({
    el:'#date'
  })
})

cmd

seajs.use('rolldate',function(undefined){
    new Rolldate({
      el:'#date'
    })
});

Options

nameRequiredDefaultsDescription
elNonullThe plugin's dom element is bound. The plugin uses document.querySelector internally. You can also pass the dom element object directly. Only a single dom element is supported.
formatNo'YYYY-MM-DD'Date format, unlimited. Rule: year-YYYY month-MM day-DD hour-hh minute-mm second-ss separated by /,-, space,:, can be combined at will
typeMonthNo'numeric'shows the text value of the month. Values: 'numeric','text' (default 'numeric')
localeMonthNotextual names of the months to be displayed in the month column. Depends on typeMonth = 'text'. Сan be a string or an array. Example: "January_February_March_April_May_June_July_August_September_October_November_December" or "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
beginYearNo2000date start year
endYearNo2100date end year
valueNonullThe default value for date initialization, such as '2018-03-18'
langNoYear, month, day ...Configure plugin language, default: title: 'Select date', cancel: 'Cancel', confirm: 'Confirm', year: 'year', month: ' Month ', day:' day ', hour:' hour ', min:' minute ', sec:' second '
minStepNo1Minutes are separated by specified number
initNonullCallback function before plugin trigger, return false can prevent plugin execution
moveEndNonullCallback function after plugin scroll, function returns a parameter (better-scroll instance)
confirmNonullThe callback function before the confirmation button is triggered, return false can prevent the plugin from executing, return other values to modify the date, the function returns a parameter (the selected date)
cancelNonullCallback function triggered when the plugin cancels
triggerNo'tap'By default, tap is used to resolve the 300ms delay of mobile click events. You can select tap to replace tap. Note that using tap will prevent other bound click events from firing
showNononeactive trigger plugin, when trigger is tap, active trigger plugin should use this method
hideNoNoneProactively hide plugins

Example

let rd = new Rolldate({
    el: '#date',
    format: 'YYYY-MM-DD',
    beginYear: 2000,
    endYear: 2100,
    minStep:1,
    lang:{title:'Select date'},
    trigger:'tap',
    init: function() {
      console.log('plugin start');
    },
    moveEnd: function(scroll) {
      console.log('End of scroll');
    },
    confirm: function(date) {
      console.log('OK button trigger');
    },
    cancel: function() {
      console.log('Plug-in canceled');
    }
});
rd.show();
rd.hide();

Photo

example

Keywords

js-date date time ios-theme ios