set minDate and maxDate in datepicker

This commit is contained in:
Bjoern Schiessle 2014-06-06 17:40:16 +02:00
parent f15d7dfec0
commit 9c00f5ddb6
2 changed files with 7 additions and 1 deletions

View File

@ -84,6 +84,8 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$date = new \DateTime($_POST['date']);
$today = new \DateTime('now');
if ($date < $today) {
OC_JSON::error(array('data' => array('message' => $l->t('Expiration date is in the past.'))));
return;

View File

@ -673,6 +673,9 @@ OC.Share={
});
if (oc_appconfig.core.defaultExpireDateEnforced) {
$('#expirationCheckbox').attr('disabled', true);
$.datepicker.setDefaults({
maxDate : new Date(date.replace(' 00:00:00', ''))
});
}
if(oc_appconfig.core.defaultExpireDateEnabled) {
$('#defaultExpireMessage').show('blind');
@ -689,7 +692,8 @@ $(document).ready(function() {
dayNames: dayNames,
dayNamesMin: $.map(dayNames, function(v) { return v.slice(0,2); }),
dayNamesShort: $.map(dayNames, function(v) { return v.slice(0,3)+'.'; }),
firstDay: firstDay
firstDay: firstDay,
minDate : new Date()
});
}
$(document).on('click', 'a.share', function(event) {