mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
New Version 1.0.9
minDate and maxDate can now be specified as -1970/01/02 and 1970/01/02 respectively
This commit is contained in:
parent
cc63cb9ddc
commit
2ed0c5478f
@ -11,7 +11,7 @@
|
||||
"timepicker",
|
||||
"datetimepicker"
|
||||
],
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.9",
|
||||
"author": {
|
||||
"name": "Chupurnov Valeriy",
|
||||
"url": "http://xdsoft.net/contacts.html"
|
||||
@ -27,6 +27,6 @@
|
||||
"docs": "http://xdsoft.net/jqplugins/datetimepicker/",
|
||||
"download": "https://github.com/xdan/datetimepicker/archive/master.zip",
|
||||
"dependencies": {
|
||||
"jquery": ">=1.5"
|
||||
"jquery": ">=1.7"
|
||||
}
|
||||
}
|
@ -29,7 +29,9 @@ $('#datetimepicker1').datetimepicker({
|
||||
$('#datetimepicker2').datetimepicker({
|
||||
timepicker:false,
|
||||
format:'d/m/Y',
|
||||
minDate:0,
|
||||
formatDate:'Y/m/d',
|
||||
minDate:'-1970/01/02', // yesterday is minimum date
|
||||
maxDate:'+1970/01/02', // and tommorow is maximum date calendar
|
||||
});
|
||||
$('#datetimepicker3').datetimepicker({
|
||||
inline:true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @preserve jQuery DateTimePicker plugin v1.0.8
|
||||
* @preserve jQuery DateTimePicker plugin v1.0.9
|
||||
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
|
||||
* (c) 2013, Chupurnov Valeriy.
|
||||
*/
|
||||
@ -114,6 +114,13 @@
|
||||
options.dayOfWeekStart = parseInt(options.dayOfWeekStart);
|
||||
if( !options.timepickerScrollbar )
|
||||
scrollbar.hide();
|
||||
var tmpDate = [];
|
||||
if( options.minDate && ( tmpDate = /^-(.*)$/.exec(options.minDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
|
||||
options.minDate = new Date((new Date).getTime()-tmpDate.getTime()).dateFormat( options.formatDate );
|
||||
}
|
||||
if( options.maxDate && ( tmpDate = /^\+(.*)$/.exec(options.maxDate) ) && (tmpDate=Date.parseDate(tmpDate[1], options.formatDate)) ){
|
||||
options.maxDate = new Date((new Date).getTime()+tmpDate.getTime()).dateFormat( options.formatDate );
|
||||
}
|
||||
options.dayOfWeekStartPrev = (options.dayOfWeekStart==0)?6:options.dayOfWeekStart-1;
|
||||
};
|
||||
datetimepicker.data('options',options);
|
||||
@ -446,9 +453,9 @@
|
||||
options.onShow&&options.onShow.call&&(onShow=options.onShow.call(datetimepicker,datetimepicker.data('xdsoft_datetime').currentTime,datetimepicker.data('input')));
|
||||
if( onShow!==false ){
|
||||
var setPos = function(){
|
||||
var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight;
|
||||
var offset = datetimepicker.data('input').offset(), top = offset.top+datetimepicker.data('input')[0].offsetHeight-1;
|
||||
if( top+datetimepicker[0].offsetHeight>$('body').height() )
|
||||
top = offset.top-datetimepicker[0].offsetHeight;
|
||||
top = offset.top-datetimepicker[0].offsetHeight+1;
|
||||
datetimepicker.css({
|
||||
left:offset.left,
|
||||
top:top,
|
||||
|
Loading…
Reference in New Issue
Block a user