date & time to the value closest to the current datetime

date & time to the value closest to the current datetime
This commit is contained in:
Valeriy 2013-11-06 14:52:16 +06:00
parent b8892a575f
commit 7bb28f1ded
3 changed files with 7 additions and 3 deletions

View File

@ -11,7 +11,7 @@
"timepicker", "timepicker",
"datetimepicker" "datetimepicker"
], ],
"version": "1.0.1", "version": "1.0.2",
"author": { "author": {
"name": "Chupurnov Valeriy", "name": "Chupurnov Valeriy",
"url": "http://xdsoft.net/contacts.html" "url": "http://xdsoft.net/contacts.html"

View File

@ -14,7 +14,7 @@ $('#datetimepicker').datetimepicker({value:'2015/04/15 05:06'});
$('#datetimepicker1').datetimepicker({ $('#datetimepicker1').datetimepicker({
datepicker:false, datepicker:false,
format:'H:i', format:'H:i',
value:'12:00', step:5,
}); });
$('#datetimepicker2').datetimepicker({ $('#datetimepicker2').datetimepicker({
timepicker:false, timepicker:false,

View File

@ -251,7 +251,11 @@
(options.maxTime!==false&&xd.strtotime(options.maxTime).getTime()<now.getTime())|| (options.maxTime!==false&&xd.strtotime(options.maxTime).getTime()<now.getTime())||
(options.minTime!==false&&xd.strtotime(options.minTime).getTime()>now.getTime()) (options.minTime!==false&&xd.strtotime(options.minTime).getTime()>now.getTime())
?'xdsoft_disabled ':' ')+ ?'xdsoft_disabled ':' ')+
((parseInt(xd.currentTime.getHours())==parseInt(h)&&parseInt(xd.currentTime.getMinutes())==parseInt(m))?' xdsoft_current ':'')+ (
(parseInt(xd.currentTime.getHours())==parseInt(h)
&&
parseInt(xd.currentTime.getMinutes()/options.step)*options.step==parseInt(m)
)?' xdsoft_current ':'')+
((parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))?' xdsoft_today ':'')+ ((parseInt(today.getHours())==parseInt(h)&&parseInt(today.getMinutes())==parseInt(m))?' xdsoft_today ':'')+
'" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>'; '" data-hour="'+h+'" data-minute="'+m+'">'+now.dateFormat(options.formatTime)+'</div>';
}; };