*
*/
+/* global moment */
+
(function() {
if (!OC.Share) {
OC.Share = {};
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;
}
password: '',
passwordChanged: false,
permissions: OC.PERMISSION_READ,
- expireDate: '2015-7-24 00:00:00',
- shareType: OC.Share.SHARE_TYPE_LINK
+ expireDate: '2015-07-24 00:00:00',
+ shareType: OC.Share.SHARE_TYPE_LINK
});
expect(updateShareStub.notCalled).toEqual(true);
clock.restore();