summaryrefslogtreecommitdiffstats
path: root/core/js/shareconfigmodel.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-01-28 12:28:30 +0100
committerVincent Petry <pvince81@owncloud.com>2016-01-28 15:25:34 +0100
commit7e1de0e3c29d79ba37b6ab911c398eda0aff57ca (patch)
tree3e1b34bbd83fe33fd3774676ccf011e66c22a096 /core/js/shareconfigmodel.js
parentb063ddb05b71988d92fe140ca003ad58301cfcc8 (diff)
downloadnextcloud-server-7e1de0e3c29d79ba37b6ab911c398eda0aff57ca.tar.gz
nextcloud-server-7e1de0e3c29d79ba37b6ab911c398eda0aff57ca.zip
Fix share default expiration date calculation
Now using UTC dates with moment js to accurately add the number of days
Diffstat (limited to 'core/js/shareconfigmodel.js')
-rw-r--r--core/js/shareconfigmodel.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/core/js/shareconfigmodel.js b/core/js/shareconfigmodel.js
index 64f18558267..5494feaf7fa 100644
--- a/core/js/shareconfigmodel.js
+++ b/core/js/shareconfigmodel.js
@@ -8,6 +8,8 @@
*
*/
+/* global moment */
+
(function() {
if (!OC.Share) {
OC.Share = {};
@@ -73,13 +75,10 @@
getDefaultExpirationDateString: function () {
var expireDateString = '';
if (this.get('isDefaultExpireDateEnabled')) {
- var date = new Date().getTime();
- var expireAfterMs = this.get('defaultExpireDate') * 24 * 60 * 60 * 1000;
- var expireDate = new Date(date + expireAfterMs);
- var month = expireDate.getMonth() + 1;
- var year = expireDate.getFullYear();
- var day = expireDate.getDate();
- expireDateString = year + "-" + month + '-' + day + ' 00:00:00';
+ var date = moment.utc();
+ var expireAfterDays = this.get('defaultExpireDate');
+ date.add(expireAfterDays, 'days');
+ expireDateString = date.format('YYYY-MM-DD 00:00:00');
}
return expireDateString;
}