I have two onSelect functions that are both working individually, but is it possible to combine them? the first converts an altField from DateTime to TIMESTAMP format. The second restricts the selectable days in the UI. I suppose I want 2 onSelect functions for each field but I can’t find the syntax. Any help would be appreciated!
Convert to TIMESTAMP:
$('#start_date').datepicker({
inline: true,
altField: 'input[name="event_start_date_min"]',
altFormat: '@',
onSelect : function(dateText, inst){
var epoch = $.datepicker.formatDate('@', $(this).datepicker('getDate')) / 1000;
$('input[name="event_start_date_min"]').val(epoch);
}
});
$('#end_date').datepicker({
inline: true,
altField: 'input[name="event_start_date_max"]',
altFormat: '@',
onSelect : function(dateText, inst){
var epoch = ($.datepicker.formatDate('@', $(this).datepicker('getDate')) / 1000)+(60*60*24);
$('input[name="event_start_date_max"]').val(epoch);
}
});
Restrict dates:
$(document).ready(function(){
$("#start_date").datepicker({
minDate: 0,
onSelect: function(selected) {
$("#end_date").datepicker("option","minDate", selected)
}
});
$("#end_date").datepicker({
minDate: 0,
onSelect: function(selected) {
$("#start_date").datepicker("option","maxDate", selected)
}
});
});
Have you tried literally combining them?