Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kirkpabk/f7c790d4784f8272f046 to your computer and use it in GitHub Desktop.
Save kirkpabk/f7c790d4784f8272f046 to your computer and use it in GitHub Desktop.
Snippets are some JQuery plugins usage samples for datetimepicker datepicker and timepicker
//DATE TIME SETUPS
// http://trentrichardson.com/
var serviceCallDate = $('#ServiceCallDate');
var completedDate = $('#CompletedDate');
var responseDate = $('#ResponseDate');
var checkedDate = $('#CheckedDate');
$('#ServiceCallDate').datetimepicker({
altField: "#ServiceCallTime",
timeFormat: 'hh:mm TT',
dateFormat: 'mm/dd/yy',
sliderAccessArgs: { touchonly: false },
onSelect: function (selectedDateTime) {
serviceCallDate.datetimepicker('option', 'maxDate', completedDate.datetimepicker('getDate'));
},
onClick: function () {
serviceCallDate.datetimepicker('option', 'maxDate', completedDate.datetimepicker('getDate'));
}
})
$('#ConditionTime,#CompletedTime,#TimeIn,#TimeOut,#ActionTime').timepicker({
addSliderAccess: true,
timeFormat: 'hh:mm TT',
sliderAccessArgs: { touchonly: false }
});
$('#CompletedDate').datepicker({
dateFormat: 'mm/dd/yy',
onClose: function (dateText, inst) {
if (serviceCallDate.val() !== '') {
var testStartDate = serviceCallDate.datetimepicker('getDate');
var testEndDate = completedDate.datetimepicker('getDate');
if (testStartDate >= testEndDate) {
startDateTextBox.datetimepicker('setDate', testEndDate);
}
}
else {
serviceCallDate.val(dateText);
}
},
onSelect: function (selectedDateTime) {
completedDate.datetimepicker('option', 'minDate', serviceCallDate.datetimepicker('getDate'));
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment