Reputation: 12927
I'm using this plugin:
http://xdsoft.net/jqplugins/datetimepicker/
Here's my fiddle:
And I'm trying to use this (which works)
var logic = function( currentDateTime ){
// 'this' is jquery object datetimepicker
if( currentDateTime.getDay()==6 ){
this.setOptions({
minTime:'11:00'
});
}else
this.setOptions({
minTime:'8:00'
});
};
jQuery('#datetimepicker_rantime').datetimepicker({
onChangeDateTime:logic,
onShow:logic
});
Except I'm using two calendars which affect eachother so I'd like to be able to do something like:
$("#end").setOptions({
minTime:'8:00'
});
But I get
setOptions is not a function
How can I select one of my date pickers without having to use "this."?
Upvotes: 0
Views: 122
Reputation: 831
Access the setOptions like this
$("#end").data("xdsoft_datetimepicker").setOptions({
minTime:'8:00'
});
I have updated your fiddle to change the end max date once the start date/time it changed.
Upvotes: 1
Reputation: 13796
Can't you just assign it as a variable?
var logic = function( currentDateTime ){
// 'this' is jquery object datetimepicker
if( currentDateTime.getDay()==6 ){
this.setOptions({
minTime:'11:00'
});
}else
this.setOptions({
minTime:'8:00'
});
};
var dateTimePickerOne = jQuery('#datetimepicker_rantime').datetimepicker({
onChangeDateTime:logic,
onShow:logic
});
Then:
dateTimePickerOne.setOptions(...)
Upvotes: 1