mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
New version 2.0.2
Fixed some bugs Added example runtime set options Code become cleaner
This commit is contained in:
parent
7ac1a799e8
commit
b551dad1e2
@ -19,12 +19,17 @@
|
||||
"input",
|
||||
"touch"
|
||||
],
|
||||
"version": "2.0.1",
|
||||
"version": "2.0.2",
|
||||
"author": {
|
||||
"name": "Chupurnov Valeriy",
|
||||
"email" : "chupurnov@gmail.com",
|
||||
"url": "http://xdsoft.net/contacts.html"
|
||||
"name": "Chupurnov Valeriy",
|
||||
"email": "chupurnov@gmail.com",
|
||||
"url": "http://xdsoft.net/contacts.html"
|
||||
},
|
||||
"maintainers": [{
|
||||
"name": "Chupurnov Valeriy",
|
||||
"email": "chupurnov@gmail.com",
|
||||
"url": "http://xdsoft.net"
|
||||
}],
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
|
120
doc.tpl
120
doc.tpl
@ -4,7 +4,6 @@
|
||||
<p>
|
||||
Use this plugin to unobtrusively add a datetimepicker, datepicker or timepicker dropdown to your forms. It's easy to customize options. <a href="https://github.com/xdan/datetimepicker">Source code on GitHub</a> or <a href="https://github.com/xdan/datetimepicker/archive/master.zip">download (zip)</a>.
|
||||
</p>
|
||||
<?php echo $this->parse('adsense5')?>
|
||||
<h3>DateTimepicker</h3>
|
||||
<input type="text" value="2014/03/15 05:06" id="datetimepicker"/><br/>
|
||||
<h3>Use mask DateTimepicker</h3>
|
||||
@ -39,7 +38,7 @@ $('#datetimepicker3').datetimepicker({
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-large btn-primary" href="https://github.com/xdan/datetimepicker/archive/master.zip">Download (zip)</a>
|
||||
</p>
|
||||
</p><?php echo $this->parse('adsense5')?>
|
||||
<h2>How do I use it?</h2>
|
||||
<p>
|
||||
First include to page css and js files
|
||||
@ -49,18 +48,22 @@ First include to page css and js files
|
||||
<script src="jquery.datetimepicker.js"></script></code></pre>
|
||||
</p>
|
||||
<h2>Examples</h2>
|
||||
<h4>Simple init DateTimePicker Example</h4>
|
||||
|
||||
<hr id="Simple"/>
|
||||
<h4>Simple init DateTimePicker Example <a href="#Simple">#</a></h4>
|
||||
<p>HTML</p>
|
||||
<pre><code data-language="html"><input id="datetimepicker" type="text" ></code></pre>
|
||||
<p>JavaScript</p>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker').datetimepicker();</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker" type="text" value="2014/03/15 05:06" /></p>
|
||||
<script>
|
||||
$(function(){$('#_datetimepicker').datetimepicker();});
|
||||
</script>
|
||||
<h4>i18n DatePicker Example</h4>
|
||||
<p>JavaScript</p>
|
||||
|
||||
<hr id="i18n"/>
|
||||
<h4>i18n DatePicker Example <a href="#i18n">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker1').datetimepicker({
|
||||
lang:'de',
|
||||
i18n:{
|
||||
@ -79,7 +82,7 @@ $(function(){$('#_datetimepicker').datetimepicker();});
|
||||
timepicker:false,
|
||||
format:'d.m.Y'
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker1" type="text" value="15.08.2013" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker1').datetimepicker({
|
||||
@ -95,13 +98,15 @@ format:'d.m.Y'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<h4>Only TimePicker Example</h4>
|
||||
<p>JavaScript</p>
|
||||
|
||||
<hr id="TimePicker"/>
|
||||
<h4>Only TimePicker Example <a href="#TimePicker">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker2').datetimepicker({
|
||||
datepicker:false,
|
||||
format:'H:i'
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker2" type="text" value="23:16" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker2').datetimepicker({
|
||||
@ -110,14 +115,16 @@ $('#_datetimepicker2').datetimepicker({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<h4>Inline DateTimePicker Example</h4>
|
||||
<p>JavaScript</p>
|
||||
|
||||
<hr id="Inline"/>
|
||||
<h4>Inline DateTimePicker Example <a href="#Inline">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker3').datetimepicker({
|
||||
format:'d.m.Y H:i',
|
||||
inline:true,
|
||||
lang:'ru'
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker3" type="text" value="10.12.2013 23:45" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker3').datetimepicker({
|
||||
@ -127,9 +134,11 @@ $('#_datetimepicker3').datetimepicker({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<h4>Icon trigger</h4>
|
||||
|
||||
<hr id="trigger"/>
|
||||
<h4>Icon trigger <a href="#trigger">#</a></h4>
|
||||
<p>Click the icon next to the input field to show the datetimepicker</p>
|
||||
<p>JavaScript</p>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker4').datetimepicker({
|
||||
format:'d.m.Y H:i',
|
||||
lang:'ru'
|
||||
@ -138,7 +147,7 @@ and handler onclick event
|
||||
<pre><code data-language="javascript">$('#image_button').click(function(){
|
||||
$('#datetimepicker4').datetimepicker('show'); //support hide,show and destroy command
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="input-group">
|
||||
@ -160,8 +169,10 @@ $('#image_button').click(function(){
|
||||
});
|
||||
|
||||
</script>
|
||||
<h4>allowTimes options TimePicker Example</h4>
|
||||
<p>JavaScript</p>
|
||||
|
||||
<hr id="allowTimes"/>
|
||||
<h4>allowTimes options TimePicker Example <a href="#allowTimes">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker5').datetimepicker({
|
||||
datepicker:false,
|
||||
allowTimes:[
|
||||
@ -169,7 +180,7 @@ $('#image_button').click(function(){
|
||||
'17:00', '17:05', '17:20', '19:00', '20:00'
|
||||
]
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker5" type="text" value="23:45" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker5').datetimepicker({
|
||||
@ -178,15 +189,17 @@ $('#_datetimepicker5').datetimepicker({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<h4>handler changeDateTime Example</h4>
|
||||
<p>JavaScript</p>
|
||||
|
||||
<hr id="onChangeDateTime"/>
|
||||
<h4>handler onChangeDateTime Example <a href="#onChangeDateTime">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker6').datetimepicker({
|
||||
timepicker:false,
|
||||
onChangeDateTime:function(dp,$input){
|
||||
alert($input.val())
|
||||
}
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker6" type="text" value="" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker6').datetimepicker({
|
||||
@ -198,15 +211,16 @@ $('#_datetimepicker6').datetimepicker({
|
||||
});
|
||||
</script>
|
||||
|
||||
<h4>minDate and maxDate Example</h4>
|
||||
<p>JavaScript</p>
|
||||
<hr id="mindate"/>
|
||||
<h4>minDate and maxDate Example <a href="#mindate">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker7').datetimepicker({
|
||||
timepicker:false,
|
||||
formatDate:'Y/m/d',
|
||||
minDate:'-1970/01/02',//yesterday is minimum date(for today use 0 or -1970/01/01)
|
||||
maxDate:'+1970/01/02'//tommorow is maximum date calendar
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker7" type="text" value="" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker7').datetimepicker({
|
||||
@ -217,13 +231,15 @@ $('#_datetimepicker7').datetimepicker({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<h4>Use mask input Example</h4>
|
||||
<p>JavaScript</p>
|
||||
|
||||
<hr id="mask"/>
|
||||
<h4>Use mask input Example <a href="#mask">#</a></h4>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">$('#datetimepicker_mask').datetimepicker({
|
||||
timepicker:false,
|
||||
mask:true, // '9999/19/39 29:59' - digit is the maximum possible for a cell
|
||||
});</code></pre>
|
||||
<p>Result</p>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker_mask" type="text" value="" /></p>
|
||||
<script>$(function(){
|
||||
$('#_datetimepicker_mask').datetimepicker({
|
||||
@ -233,6 +249,45 @@ $('#_datetimepicker_mask').datetimepicker({
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<hr id="runtime_options"/>
|
||||
<h4>Set options runtime DateTimePicker <a href="#runtime_options">#</a></h4>
|
||||
<p>If select day is Saturday, the minimum set 11:00, otherwise 8:00</p>
|
||||
<p><strong>javaScript</strong></p>
|
||||
<pre><code data-language="javascript">var logic = function( currentDateTime ){
|
||||
// 'this' is jquery object datetimepicker
|
||||
if( currentDateTime.getDay()==6 ){
|
||||
this.setOptions({
|
||||
minTime:'11:00'
|
||||
});
|
||||
}else
|
||||
this.setOptions({
|
||||
minTime:'8:00'
|
||||
});
|
||||
};
|
||||
$('#datetimepicker_rantime').datetimepicker({
|
||||
onChangeDateTime:logic,
|
||||
onShow:logic
|
||||
});</code></pre>
|
||||
<p><strong>Result</strong></p>
|
||||
<p><input id="_datetimepicker_runtime" type="text" value="" /></p>
|
||||
<script>$(function(){
|
||||
var logic = function( currentDateTime ){
|
||||
if( currentDateTime.getDay()==6 ){
|
||||
this.setOptions({
|
||||
minTime:'11:00'
|
||||
});
|
||||
}else
|
||||
this.setOptions({
|
||||
minTime:'8:00'
|
||||
});
|
||||
};
|
||||
$('#_datetimepicker_runtime').datetimepicker({
|
||||
onChangeDateTime:logic,
|
||||
onShow:logic
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<h2>Full options list</h2>
|
||||
<table class="table table-condensed table-bordered table-striped">
|
||||
<thead>
|
||||
@ -451,13 +506,13 @@ $('#_datetimepicker_mask').datetimepicker({
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>yearStart/td>
|
||||
<td>yearStart</td>
|
||||
<td>1950</td>
|
||||
<td>Start value for fast Year selector</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>yearEnd/td>
|
||||
<td>yearEnd</td>
|
||||
<td>2050</td>
|
||||
<td>End value for fast Year selector</td>
|
||||
<td> </td>
|
||||
@ -472,5 +527,8 @@ $('#_datetimepicker_mask').datetimepicker({
|
||||
</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td>className</td><td></td><td></td><td></td></tr>
|
||||
<tr><td>id</td><td></td><td></td><td></td></tr>
|
||||
<tr><td>style</td><td></td><td></td><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
17
index.html
17
index.html
@ -22,6 +22,9 @@
|
||||
<input type="text" id="datetimepicker5"/><br><br>
|
||||
<h3>Destroy DateTimePicker</h3>
|
||||
<input type="text" id="datetimepicker6"/><input id="destroy" type="button" value="destroy"/>
|
||||
<h3>Set options runtime DateTimePicker</h3>
|
||||
<input type="text" id="datetimepicker7"/>
|
||||
<p>If select day is Saturday, the minimum set 11:00, otherwise 8:00</p>
|
||||
</body>
|
||||
<script src="./jquery.js"></script>
|
||||
<script src="./jquery.datetimepicker.js"></script>
|
||||
@ -67,5 +70,19 @@ $('#destroy').click(function(){
|
||||
this.value = 'destroy';
|
||||
}
|
||||
});
|
||||
var logic = function( currentDateTime ){
|
||||
if( currentDateTime.getDay()==6 ){
|
||||
this.setOptions({
|
||||
minTime:'11:00'
|
||||
});
|
||||
}else
|
||||
this.setOptions({
|
||||
minTime:'8:00'
|
||||
});
|
||||
};
|
||||
$('#datetimepicker7').datetimepicker({
|
||||
onChangeDateTime:logic,
|
||||
onShow:logic
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user