new version 2.1.4

Fix bug with setOptions({value:'2011/12/11 12:00'})
This commit is contained in:
Valeriy 2014-01-09 12:54:36 +06:00
parent e22f12f2a8
commit 0df3b7e420
5 changed files with 59 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{ {
"name":"datetimepicker", "name":"datetimepicker",
"version":"2.1.3", "version":"2.1.4",
"main": [ "main": [
"jquery.datetimepicker.js", "jquery.datetimepicker.js",
"jquery.datetimepicker.css" "jquery.datetimepicker.css"

View File

@ -1,6 +1,7 @@
{ {
"name": "datetimepicker", "name": "datetimepicker",
"title": "jQuery Date and Time picker", "version": "2.1.4",
"title": "jQuery Date and Time picker",
"description": "jQuery plugin for date, time, or datetime manipulation in form", "description": "jQuery plugin for date, time, or datetime manipulation in form",
"keywords": [ "keywords": [
"calendar", "calendar",
@ -20,7 +21,6 @@
"jquery", "jquery",
"touch" "touch"
], ],
"version": "2.1.3",
"author": { "author": {
"name": "Chupurnov Valeriy", "name": "Chupurnov Valeriy",
"email": "chupurnov@gmail.com", "email": "chupurnov@gmail.com",

49
doc.tpl
View File

@ -339,6 +339,55 @@ $('#_datetimepicker_weekends_disable').datetimepicker({
}); });
}); });
</script> </script>
<hr id="range"/>
<h4>Range between date<a href="#range">#</a></h4>
<p><strong>javaScript</strong></p>
<pre><code data-language="javascript">$(function(){
$(&#39;#date_timepicker_start&#39;).datetimepicker({
format:&#39;Y/m/d&#39;,
onShow:function( ct ){
this.setOptions({
maxDate:$(&#39;#date_timepicker_end&#39;).val()?$(&#39;#date_timepicker_end&#39;).val():false
})
},
timepicker:false
});
$(&#39;#date_timepicker_end&#39;).datetimepicker({
format:&#39;Y/m/d&#39;,
onShow:function( ct ){
this.setOptions({
minDate:$(&#39;#date_timepicker_start&#39;).val()?$(&#39;#date_timepicker_start&#39;).val():false
})
},
timepicker:false
});
});</code></pre>
<p><strong>Result</strong></p>
<p>
Start <input id="date_timepicker_start" type="text" value="" placeholder="start" />&nbsp;
End <input id="date_timepicker_end" type="text" value="" placeholder="end" />
</p>
<script>$(function(){
$('#date_timepicker_start').datetimepicker({
format:'Y/m/d',
onShow:function( ct ){
this.setOptions({
maxDate:$('#date_timepicker_end').val()?$('#date_timepicker_end').val():false
})
},
timepicker:false
});
$('#date_timepicker_end').datetimepicker({
format:'Y/m/d',
onShow:function( ct ){
this.setOptions({
minDate:$('#date_timepicker_start').val()?$('#date_timepicker_start').val():false
})
},
timepicker:false
});
});
</script>
<h2>Full options list</h2> <h2>Full options list</h2>
<table class="table table-condensed table-bordered table-striped"> <table class="table table-condensed table-bordered table-striped">
<thead> <thead>

View File

@ -15,7 +15,7 @@
<h3>DatePicker</h3> <h3>DatePicker</h3>
<input type="text" id="datetimepicker2"/><br><br> <input type="text" id="datetimepicker2"/><br><br>
<h3>Inline DateTimePicker</h3> <h3>Inline DateTimePicker</h3>
<input type="text" id="datetimepicker3"/><br><br> <input type="text" id="datetimepicker3"/><input type="button" onclick="$('#datetimepicker3').datetimepicker({value:'2011/12/11 12:00'})" value="set inline value 2011/12/11 12:00"/><br><br>
<h3>Button Trigger</h3> <h3>Button Trigger</h3>
<input type="text" value="2013/12/03 18:00" id="datetimepicker4"/><input id="open" type="button" value="open"/><input id="close" type="button" value="close"/><input id="reset" type="button" value="reset"/> <input type="text" value="2013/12/03 18:00" id="datetimepicker4"/><input id="open" type="button" value="open"/><input id="close" type="button" value="close"/><input id="reset" type="button" value="reset"/>
<h3>TimePicker allows time</h3> <h3>TimePicker allows time</h3>

View File

@ -1,5 +1,5 @@
/** /**
* @preserve jQuery DateTimePicker plugin v2.1.3 * @preserve jQuery DateTimePicker plugin v2.1.4
* @homepage http://xdsoft.net/jqplugins/datetimepicker/ * @homepage http://xdsoft.net/jqplugins/datetimepicker/
* (c) 2013, Chupurnov Valeriy. * (c) 2013, Chupurnov Valeriy.
*/ */
@ -323,8 +323,10 @@
if( options.datepicker && !options.timepicker ) if( options.datepicker && !options.timepicker )
timepicker.removeClass('active'); timepicker.removeClass('active');
if( options.value ) if( options.value ){
input&&input.val&&input.val(options.value); input&&input.val&&input.val(options.value);
_xdsoft_datetime.setCurrentTime(options.value);
}
if( isNaN(options.dayOfWeekStart)||parseInt(options.dayOfWeekStart)<0||parseInt(options.dayOfWeekStart)>6 ) if( isNaN(options.dayOfWeekStart)||parseInt(options.dayOfWeekStart)<0||parseInt(options.dayOfWeekStart)>6 )
options.dayOfWeekStart = 0; options.dayOfWeekStart = 0;
@ -501,7 +503,7 @@
$('body').append(datetimepicker); $('body').append(datetimepicker);
var XDSoftDateTime = function() { var _xdsoft_datetime = new function() {
var _this = this; var _this = this;
_this.now = function() { _this.now = function() {
return new Date(); return new Date();
@ -575,8 +577,7 @@
_this.str = function() { _this.str = function() {
return _this.currentTime.dateFormat(options.format); return _this.currentTime.dateFormat(options.format);
}; };
}, };
_xdsoft_datetime = new XDSoftDateTime;
mounth_picker mounth_picker
.find('.xdsoft_today_button') .find('.xdsoft_today_button')
.on('mousedown.xdsoft',function() { .on('mousedown.xdsoft',function() {