From 5c193692f7df66aa3ab6d0ce4641801b43d7d88f Mon Sep 17 00:00:00 2001 From: Valeriy Date: Fri, 13 Dec 2013 13:07:05 +0600 Subject: [PATCH] Fix bug with options.step>60 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added options.roundTime possible values ​​round, ceil, floor Update doc --- doc.tpl | 142 ++++++++++++++++++++------------------- jquery.datetimepicker.js | 3 +- 2 files changed, 76 insertions(+), 69 deletions(-) diff --git a/doc.tpl b/doc.tpl index dd84e85..4862dde 100644 --- a/doc.tpl +++ b/doc.tpl @@ -326,8 +326,8 @@ $('#_datetimepicker_ongenerate').datetimepicker({ - - value + + value null Current value datetimepicker. If it is set, ignored input.value @@ -335,16 +335,16 @@ $('#_datetimepicker_ongenerate').datetimepicker({ format:'d.m.Y'} - - lang + + lang en Language i18n (en,ru,de,nl)
{lang:'ru'}
- - format + + format Y/m/d H:i Format datetime. More  @@ -352,60 +352,60 @@ $('#_datetimepicker_ongenerate').datetimepicker({ {format:'Y'} - - formatDate + + formatDate Y/m/d Format date for minDate and maxDate
{formatDate:'d.m.Y'}
- - formatTime + + formatTime H:i  Similarly, formatDate . But for minTime and maxTime
{formatTime:'H'}
- - step + + step 60 Step time
{step:5}
- - closeOnDateSelect + + closeOnDateSelect 0
{closeOnDateSelect:true}
- - closeOnWithoutClick + + closeOnWithoutClick true
{ closeOnWithoutClick :false}
- - validateOnBlur + + validateOnBlur true Verify datetime value from input, when losing focus. If value is not valid datetime, then to value inserts the current datetime
{ validateOnBlur:false}
- - timepicker + + timepicker true
{timepicker:false}
- - datepicker + + datepicker true
{datepicker:false}
- - minDate + + minDate false
{minDate:0} // today
@@ -413,8 +413,8 @@ $('#_datetimepicker_ongenerate').datetimepicker({
 {minDate:'-1970/01/02'} // yesterday
 {minDate:'05.12.2013',formatDate:'d.m.Y'}
- - maxDate + + maxDate false
{maxDate:0,}
@@ -422,24 +422,24 @@ $('#_datetimepicker_ongenerate').datetimepicker({
 {maxDate:'+1970/01/02'} // tommorrow
 {maxDate:'05.12.2013',formatDate:'d.m.Y'}
- - minTime + + minTime false
{minTime:0,}// now
 {minTime:'12:00'}
 {minTime:'13:45:34',formatTime:'H:i:s'}
- - maxTime + + maxTime false
{maxTime:0,}
 {maxTime:'12:00'}
 {maxTime:'13:45:34',formatTime:'H:i:s'}
- - allowTimes + + allowTimes []
{allowTimes:[
@@ -449,8 +449,8 @@ $('#_datetimepicker_ongenerate').datetimepicker({
 	'21:00'
 ]}
- - mask + + mask false Use mask for input. true - automatically generates a mask on the field 'format', Digit from 0 to 9, set the highest possible digit for the value. For example: the first digit of hours can not be greater than 2, and the first digit of the minutes can not be greater than 5
{mask:'9999/19/39',format:'Y/m/d'}
@@ -458,100 +458,106 @@ $('#_datetimepicker_ongenerate').datetimepicker({
 {mask:'29:59',format:'H:i'} //
 {mask:true,format:'H:i'} //automatically generate a mask 99:99
- - opened + + opened false   - - inline + + inline false   - - timepickerScrollbar + + timepickerScrollbar true   - - onSelectDate + + onSelectDate function(){}
onSelectDate:function(current_time,$input){
   alert(current.dateFormat('d/m/Y'))
 }
- - onSelectTime + + onSelectTime function(){}   - - onChangeMonth + + onChangeMonth function(){}   - - onChangeDateTime + + onChangeDateTime function(){}   - - onShow + + onShow function(){}   - - onClose + + onClose function(){}   - - onGenerate + + onGenerate function(){} trigger after construct calendar and timepicker   - + withoutCopyright true   - - inverseButton + + inverseButton false   - - hours12 + + hours12 false   - - yearStart + + yearStart 1950 Start value for fast Year selector   - - yearEnd + + yearEnd 2050 End value for fast Year selector   - - dayOfWeekStart + + roundTime + round + Round time in timepicker, possible values: round, ceil, floor +
{roundTime:'floor'}
+ + + dayOfWeekStart 0

Star week DatePicker. Default Sunday - 0.

@@ -560,8 +566,8 @@ $('#_datetimepicker_ongenerate').datetimepicker({   - className - id - style + className + id + style diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index e2567cb..dadb2a5 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -203,6 +203,7 @@ yearEnd:2050, style:'', id:'', + roundTime:'round', // ceil, floor className:'' }, options = ($.isPlainObject(opt)||!opt)?$.extend({},default_options,opt):$.extend({},default_options), @@ -653,7 +654,7 @@ ( (parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h) && - Math.round(_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m) + (options.step>59||Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m)) )?' xdsoft_current ':'')+ ((parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))?' xdsoft_today ':'')+ '" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'';