1.3.0 • Published 7 years ago
mob-date-selector v1.3.0
Intro
- User-defined units. You can set year and month or month, date, hour and minute.
- User-defined time ranges. You can set anytime with the precision of a minute
- For example, you can set begin time at Dec -27(th), 2011 102:12 and end time at Oct 21(st), 2020 20:20
1. How to use
npm i mob-date-selector --save-dev
2. How to import
webpack.config.js:
var path = require('path');
module.exports = {
entry : {...},
output : {...},
module : {
loaders :[{
test: /\.css$/,
loader: 'style!css'
}, {
test: /\.js$/,
exclude: path.resolve('./node_modules'),
loader: 'babel',
}]
}
}
html:
<body>
<!-- the #date-selector-input can be any other dom for your convenient-->
<input id="date-selector-input" type="text" readonly/>
<!-- the #targetContainer must be the outermost dom below body -->
<div id="targetContainer"></div>
</body>
js:
import DateSelector from 'mob-date-selector';
new DateSelector({ ... });
Parameter List:
Attributes | Type | Value | Details |
---|---|---|---|
input | {String} | eg:'date-selector-input' | the id of the dom you touch. |
container | {String} | eg:'targetContainers' | the id of the container you ready to append dom. |
type | {Number} | 0 OR 1 | 0:free style without tab; 1: fixed style with tab. |
param | {Array} | eg:0, 1, 1, 1, 1 | user-defined units, every position means 'year', 'month', 'day', 'hour', 'minute'. 1 means you need the unit,0 means you dont need it. There must be serial 1. |
beginTime | {Array} | eg:3,27,12,12 Mar 27(th) 12:12 default : 1970, 1, 1, 0, 0 | user-defined begin time points. An empty array means default array. The equivalent of every position is the sequent position of 1 in param . |
endTime | {Array} | the same to beginTime default : nextYear, 12, 31, 23, 59 | user-defined end time points. An empty array means default array. The equivalent of every position is the sequent position of 1 in param . |
recentTime | {Array} | the same to beginTime | user-defined recent time points. An empty array means NOW. The equivalent of every position is the sequent position of 1 in param . |
success | {function} | function(arr){alert(arr)} | function(arr){} User-defined callback. The first param is the result. |
3. Tips
- For questions and issues please use THIS WAY
- You must instantiate it after ready.
- I am Appian.