From 98f12c07dd508c2ebe3ec6212ed6b75dc5a43b0a Mon Sep 17 00:00:00 2001 From: Valeriy Date: Thu, 12 Dec 2013 15:43:03 +0600 Subject: [PATCH] Fix round time Time is rounded to the nearest value --- index.html | 2 +- jquery.datetimepicker.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 712837f..f613908 100644 --- a/index.html +++ b/index.html @@ -35,7 +35,7 @@ $('#datetimepicker_mask').datetimepicker({ mask:'9999/19/39 29:59', }); $('#datetimepicker').datetimepicker(); -$('#datetimepicker').datetimepicker({value:'2015/04/15 05:06'}); +$('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10}); $('#datetimepicker1').datetimepicker({ datepicker:false, format:'H:i', diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 78f862c..e26f20b 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -653,7 +653,7 @@ ( (parseInt(_xdsoft_datetime.currentTime.getHours())==parseInt(h) && - parseInt(_xdsoft_datetime.currentTime.getMinutes()/options.step)*options.step==parseInt(m) + Math.round(_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)+'';