diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-06 17:40:16 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-06-06 17:40:16 +0200 |
commit | 9c00f5ddb61507f7bd02a79e2a62339b45b20c0b (patch) | |
tree | 5538d26c65a26b078e1b49bfbc1b37637257023e | |
parent | f15d7dfec06ff895b8956741277f5ec8d6f4fa92 (diff) | |
download | nextcloud-server-9c00f5ddb61507f7bd02a79e2a62339b45b20c0b.tar.gz nextcloud-server-9c00f5ddb61507f7bd02a79e2a62339b45b20c0b.zip |
set minDate and maxDate in datepicker
-rw-r--r-- | core/ajax/share.php | 2 | ||||
-rw-r--r-- | core/js/share.js | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index feb64490b4e..be72e36541a 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -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; diff --git a/core/js/share.js b/core/js/share.js index 2add2841139..dc808c295b9 100644 --- a/core/js/share.js +++ b/core/js/share.js @@ -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) { |