Fix list issue

This commit is contained in:
Valeriy 2014-06-30 17:45:25 +06:00
commit 3110364005
4 changed files with 176 additions and 161 deletions

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "datetimepicker", "name": "datetimepicker",
"version": "2.2.9", "version": "2.3.0",
"title": "jQuery Date and Time picker", "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": [

View File

@ -1,152 +1,158 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="./jquery.datetimepicker.css"/> <link rel="stylesheet" type="text/css" href="./jquery.datetimepicker.css"/>
</head> <style type="text/css">
<body>
<p><a href="http://xdsoft.net/jqplugins/datetimepicker/">Homepage</a></p> .custom-date-style {
<h3>DateTimePicker</h3> background-color: red !important;
<input type="text" value="2014/03/15 05:06" id="datetimepicker"/><br><br> }
<h3>Mask DateTimePicker</h3>
<input type="text" value="" id="datetimepicker_mask"/><br><br> </style>
<h3>TimePicker</h3> </head>
<input type="text" id="datetimepicker1"/><br><br> <body>
<h3>DatePicker</h3> <p><a href="http://xdsoft.net/jqplugins/datetimepicker/">Homepage</a></p>
<input type="text" id="datetimepicker2"/><br><br> <h3>DateTimePicker</h3>
<h3>Inline DateTimePicker</h3> <input type="text" value="2014/03/15 05:06" id="datetimepicker"/><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>Mask DateTimePicker</h3>
<h3>Button Trigger</h3> <input type="text" value="" id="datetimepicker_mask"/><br><br>
<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</h3>
<h3>TimePicker allows time</h3> <input type="text" id="datetimepicker1"/><br><br>
<input type="text" id="datetimepicker5"/><br><br> <h3>DatePicker</h3>
<h3>Destroy DateTimePicker</h3> <input type="text" id="datetimepicker2"/><br><br>
<input type="text" id="datetimepicker6"/><input id="destroy" type="button" value="destroy"/> <h3>Inline DateTimePicker</h3>
<h3>Set options runtime DateTimePicker</h3> <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>
<input type="text" id="datetimepicker7"/> <h3>Button Trigger</h3>
<p>If select day is Saturday, the minimum set 11:00, otherwise 8:00</p> <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>onGenerate</h3> <h3>TimePicker allows time</h3>
<input type="text" id="datetimepicker8"/> <input type="text" id="datetimepicker5"/><br><br>
<h3>disable all weekend</h3> <h3>Destroy DateTimePicker</h3>
<input type="text" id="datetimepicker9"/> <input type="text" id="datetimepicker6"/><input id="destroy" type="button" value="destroy"/>
<h3>Show inline</h3> <h3>Set options runtime DateTimePicker</h3>
<a href="javascript:var si = document.getElementById('show_inline').style; si.display = (si.display=='none')?'block':'none';return false; ">Show/Hide</a> <input type="text" id="datetimepicker7"/>
<div id="show_inline" style="display:none"> <p>If select day is Saturday, the minimum set 11:00, otherwise 8:00</p>
<input type="text" id="datetimepicker10"/> <h3>onGenerate</h3>
</div> <input type="text" id="datetimepicker8"/>
<h3>Date Time Picker start time</h3> <h3>disable all weekend</h3>
<input type="text" id="datetimepicker_start_time"/> <input type="text" id="datetimepicker9"/>
<h3>Date Time Picker from unixtime</h3> <h3>Show inline</h3>
<input type="text" id="datetimepicker_unixtime"/> <a href="javascript:var si = document.getElementById('show_inline').style; si.display = (si.display=='none')?'block':'none';return false; ">Show/Hide</a>
<h3>Date Time Picker with day of year and week of year</h3> <div id="show_inline" style="display:none">
<input type="text" id="datetimepicker11"/> <input type="text" id="datetimepicker10"/>
</body> </div>
<script type="text/javascript" src="./jquery.js"></script> <h3>Disable Specific Dates</h3>
<script type="text/javascript" src="./jquery.datetimepicker.js"></script> <p>Disable the dates 2 days from now.</p>
<script type="text/javascript"> <input type="text" id="datetimepicker11"/>
$('#datetimepicker').datetimepicker() <h3>Custom Date Styling</h3>
.datetimepicker({value:'2015/04/15 05:03',step:10}); <p>Make the background of the date 2 days from now bright red.</p>
<input type="text" id="datetimepicker12"/>
$('#datetimepicker_mask').datetimepicker({ </body>
mask:'9999/19/39 29:59' <script src="./jquery.js"></script>
}); <script src="./jquery.datetimepicker.js"></script>
<script>
$('#datetimepicker1').datetimepicker({
datepicker:false, $('#datetimepicker10').datetimepicker({
format:'H:i', step:5,
step:5 inline:true
}); });
$('#datetimepicker2').datetimepicker({ $('#datetimepicker_mask').datetimepicker({
yearOffset:222, mask:'9999/19/39 29:59'
lang:'ch', });
timepicker:false, $('#datetimepicker').datetimepicker();
format:'d/m/Y', $('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10});
formatDate:'Y/m/d', $('#datetimepicker1').datetimepicker({
minDate:'-1970/01/02', // yesterday is minimum date datepicker:false,
maxDate:'+1970/01/02' // and tommorow is maximum date calendar format:'H:i',
}); step:5
$('#datetimepicker3').datetimepicker({ });
inline:true $('#datetimepicker2').datetimepicker({
}); yearOffset:222,
$('#datetimepicker4').datetimepicker(); lang:'ch',
$('#open').click(function(){ timepicker:false,
$('#datetimepicker4').datetimepicker('show'); format:'d/m/Y',
}); formatDate:'Y/m/d',
$('#close').click(function(){ minDate:'-1970/01/02', // yesterday is minimum date
$('#datetimepicker4').datetimepicker('hide'); maxDate:'+1970/01/02' // and tommorow is maximum date calendar
}); });
$('#reset').click(function(){ $('#datetimepicker3').datetimepicker({
$('#datetimepicker4').datetimepicker('reset'); inline:true
}); });
$('#datetimepicker5').datetimepicker({ $('#datetimepicker4').datetimepicker();
datepicker:false, $('#open').click(function(){
allowTimes:['12:00','13:00','15:00','17:00','17:05','17:20','19:00','20:00'] $('#datetimepicker4').datetimepicker('show');
}); });
$('#datetimepicker6').datetimepicker(); $('#close').click(function(){
$('#destroy').click(function(){ $('#datetimepicker4').datetimepicker('hide');
if( $('#datetimepicker6').data('xdsoft_datetimepicker') ){ });
$('#datetimepicker6').datetimepicker('destroy'); $('#reset').click(function(){
this.value = 'create'; $('#datetimepicker4').datetimepicker('reset');
}else{ });
$('#datetimepicker6').datetimepicker(); $('#datetimepicker5').datetimepicker({
this.value = 'destroy'; datepicker:false,
} allowTimes:['12:00','13:00','15:00','17:00','17:05','17:20','19:00','20:00'],
}); step:5
var logic = function( currentDateTime ){ });
if( currentDateTime ){ $('#datetimepicker6').datetimepicker();
if( currentDateTime.getDay()==6 ){ $('#destroy').click(function(){
this.setOptions({ if( $('#datetimepicker6').data('xdsoft_datetimepicker') ){
minTime:'11:00' $('#datetimepicker6').datetimepicker('destroy');
}); this.value = 'create';
}else }else{
this.setOptions({ $('#datetimepicker6').datetimepicker();
minTime:'8:00' this.value = 'destroy';
}); }
} });
}; var logic = function( currentDateTime ){
$('#datetimepicker7').datetimepicker({ if( currentDateTime.getDay()==6 ){
onChangeDateTime:logic, this.setOptions({
onShow:logic minTime:'11:00'
}); });
$('#datetimepicker8').datetimepicker({ }else
onGenerate:function( ct ){ this.setOptions({
$(this).find('.xdsoft_date') minTime:'8:00'
.toggleClass('xdsoft_disabled'); });
}, };
minDate:'-1970/01/2', $('#datetimepicker7').datetimepicker({
maxDate:'+1970/01/2', onChangeDateTime:logic,
timepicker:false onShow:logic
}); });
$('#datetimepicker9').datetimepicker({ $('#datetimepicker8').datetimepicker({
onGenerate:function( ct ){ onGenerate:function( ct ){
$(this).find('.xdsoft_date.xdsoft_weekend') $(this).find('.xdsoft_date')
.addClass('xdsoft_disabled'); .toggleClass('xdsoft_disabled');
}, },
weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'], minDate:'-1970/01/2',
timepicker:false maxDate:'+1970/01/2',
}); timepicker:false
});
$('#datetimepicker9').datetimepicker({
$('#datetimepicker10').datetimepicker({ onGenerate:function( ct ){
step:5, $(this).find('.xdsoft_date.xdsoft_weekend')
inline:true .addClass('xdsoft_disabled');
}); },
weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'],
$('#datetimepicker_start_time').datetimepicker({ timepicker:false
startDate:'+1970/05/01' });
}); var dateToDisable = new Date();
dateToDisable.setDate(dateToDisable.getDate() + 2);
$('#datetimepicker_unixtime').datetimepicker({ $('#datetimepicker11').datetimepicker({
format:'unixtime' beforeShowDay: function(date) {
}); if (date.getMonth() == dateToDisable.getMonth() && date.getDate() == dateToDisable.getDate()) {
$('#datetimepicker11').datetimepicker({ return [false, ""]
hours12: false, }
format: 'Y-z H:i W',
step: 1, return [true, ""];
opened: false, }
validateOnBlur: false, });
closeOnDateSelect: false, $('#datetimepicker12').datetimepicker({
closeOnTimeSelect: false beforeShowDay: function(date) {
}); if (date.getMonth() == dateToDisable.getMonth() && date.getDate() == dateToDisable.getDate()) {
</script> return [true, "custom-date-style"];
</html> }
return [true, ""];
}
});
</script>
</html>

View File

@ -1,5 +1,5 @@
/** /**
* @preserve jQuery DateTimePicker plugin v2.2.9 * @preserve jQuery DateTimePicker plugin v2.3.0
* @homepage http://xdsoft.net/jqplugins/datetimepicker/ * @homepage http://xdsoft.net/jqplugins/datetimepicker/
* (c) 2014, Chupurnov Valeriy. * (c) 2014, Chupurnov Valeriy.
*/ */
@ -272,7 +272,8 @@
className:'', className:'',
weekends : [], weekends : [],
yearOffset:0 yearOffset:0,
beforeShowDay: null
}; };
// fix for ie8 // fix for ie8
@ -534,7 +535,7 @@
datepicker.addClass('active'); datepicker.addClass('active');
else else
datepicker.removeClass('active'); datepicker.removeClass('active');
if( options.timepicker ) if( options.timepicker )
timepicker.addClass('active'); timepicker.addClass('active');
else else
@ -936,7 +937,7 @@
minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate()); minDate = new Date(minDate.getFullYear(),minDate.getMonth(),minDate.getDate());
} }
var d,y,m,classes = []; var d,y,m,classes = [],customDateSettings;
while( i<_xdsoft_datetime.currentTime.countDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) { while( i<_xdsoft_datetime.currentTime.countDaysInMonth()||start.getDay()!=options.dayOfWeekStart||_xdsoft_datetime.currentTime.getMonth()==start.getMonth() ) {
classes = []; classes = [];
@ -946,14 +947,22 @@
classes.push('xdsoft_date'); classes.push('xdsoft_date');
if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate ) ){ if ( options.beforeShowDay && options.beforeShowDay.call ) {
customDateSettings = options.beforeShowDay.call(datetimepicker, start);
} else {
customDateSettings = null;
}
if( ( maxDate!==false && start > maxDate )||( minDate!==false && start < minDate )||(customDateSettings && customDateSettings[0] === false) ){
classes.push('xdsoft_disabled'); classes.push('xdsoft_disabled');
} }
if( _xdsoft_datetime.currentTime.getMonth()!=m ){ if ( customDateSettings && customDateSettings[1] != "" ) {
classes.push('xdsoft_other_month'); classes.push(customDateSettings[1]);
} }
if( _xdsoft_datetime.currentTime.getMonth()!=m ) classes.push('xdsoft_other_month');
if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) { if( (options.defaultSelect||datetimepicker.data('changed')) && _xdsoft_datetime.currentTime.dateFormat( options.formatDate )==start.dateFormat( options.formatDate ) ) {
classes.push('xdsoft_current'); classes.push('xdsoft_current');
} }