date picker for mobile using javascript and acting like native date picker
1 local demo
git clone this project
npm install
gulp
2 online demo http://wikieswan.github.io/m-date-picker/html/index.html
open with the QR code image
<link rel="stylesheet" type="text/css" href="path/to/m-date-picker.css">
<script type="text/javascript" src="path/to/zepto.js"></script>
<script type="text/javascript" src="path/to/m-date-picker.js"></script>
tip: m-date-picker.js depends on zepeto.js ,so you should import zepeto.js before
var mdp = $.mdatepicker({
mode: 'date', // date time datetime datemonth
defaultDate: '2014/2/1',
okText: 'Ok',
cancelText: 'Cancel',
onDateChange: function(date){
console.log(date)
},
onCancel: function(){
},
unitVisiable: true,
local: 'en'
})
mdp.show();
name | description | type | default |
---|---|---|---|
mode | date picker mode | String | 'date' enum('date', 'time', 'datetime','datemonth') |
defaultDate | default selected date | String | now |
okText | ok button text | String | 'Ok' |
cancelText | cancel button text | String | 'Cancel' |
onDateChange | exec on ok | Function(date: String) | |
onCancel | exec on dismiss | function | |
unitVisiable | is unit visiable | boolean | true |
local | language to use | String | 'local' enmu('en','zh') |
m-date-picker is released under the MIT license.