diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2015-10-03 17:06:48 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-04 11:38:29 +0200 |
commit | 96deeca34d3e5cc930e171a2e3c826d53f513da1 (patch) | |
tree | 5ab4912f0ec1d07218e357c586104764906b3a9a /core | |
parent | 2ffb1c2135d80ac82f62c2bd403fe452e2c4e51d (diff) | |
download | nextcloud-server-96deeca34d3e5cc930e171a2e3c826d53f513da1.tar.gz nextcloud-server-96deeca34d3e5cc930e171a2e3c826d53f513da1.zip |
Use DD-MM-YYYY consistently in share sidebar
We used to display the response from the server. Which is in non ISO8601
format. Now this is weird since the datepickers shows us 'DD-MM-YYYY'
once a date is chosen.
Now use momentJS to properly format the date.
* Unit tests updated
Diffstat (limited to 'core')
-rw-r--r-- | core/js/sharedialogexpirationview.js | 7 | ||||
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 13 |
2 files changed, 11 insertions, 9 deletions
diff --git a/core/js/sharedialogexpirationview.js b/core/js/sharedialogexpirationview.js index fab48f5e6bc..772b9ba97dc 100644 --- a/core/js/sharedialogexpirationview.js +++ b/core/js/sharedialogexpirationview.js @@ -132,6 +132,11 @@ var isExpirationSet = !!this.model.get('linkShare').expiration || isExpirationEnforced; + var expiration; + if (isExpirationSet) { + expiration = moment(this.model.get('linkShare').expiration, 'YYYY-MM-DD').format('DD-MM-YYYY') + } + var expirationTemplate = this.template(); this.$el.html(expirationTemplate({ setExpirationLabel: t('core', 'Set expiration date'), @@ -142,7 +147,7 @@ isExpirationSet: isExpirationSet, isExpirationEnforced: isExpirationEnforced, disableCheckbox: isExpirationEnforced && isExpirationSet, - expirationValue: this.model.get('linkShare').expiration + expirationValue: expiration })); // what if there is another date picker on that page? diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index de6f9944094..37590ba79c2 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -274,10 +274,10 @@ describe('OC.Share.ShareDialogView', function() { expect(dialog.$el.find('#expirationDate').val()).toEqual(''); }); it('checks expiration date checkbox and populates field when expiration date was set', function() { - shareModel.get('linkShare').expiration = 1234; + shareModel.get('linkShare').expiration = '2014-02-01 00:00:00'; dialog.render(); expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true); - expect(dialog.$el.find('#expirationDate').val()).toEqual('1234'); + expect(dialog.$el.find('#expirationDate').val()).toEqual('01-02-2014'); }); it('sets default date when default date setting is enabled', function() { configModel.set('isDefaultExpireDateEnabled', true); @@ -289,8 +289,7 @@ describe('OC.Share.ShareDialogView', function() { // enabled by default expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true); - // TODO: those zeros must go... - expect(dialog.$el.find('#expirationDate').val()).toEqual('2014-1-27 00:00:00'); + expect(dialog.$el.find('#expirationDate').val()).toEqual('27-01-2014'); // disabling is allowed dialog.$el.find('[name=expirationCheckbox]').click(); @@ -308,8 +307,7 @@ describe('OC.Share.ShareDialogView', function() { dialog.render(); expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true); - // TODO: those zeros must go... - expect(dialog.$el.find('#expirationDate').val()).toEqual('2014-1-27 00:00:00'); + expect(dialog.$el.find('#expirationDate').val()).toEqual('27-01-2014'); // disabling is not allowed expect(dialog.$el.find('[name=expirationCheckbox]').prop('disabled')).toEqual(true); @@ -338,8 +336,7 @@ describe('OC.Share.ShareDialogView', function() { ); expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true); - // TODO: those zeros must go... - expect(dialog.$el.find('#expirationDate').val()).toEqual('2014-1-27 00:00:00'); + expect(dialog.$el.find('#expirationDate').val()).toEqual('27-01-2014'); // disabling is not allowed expect(dialog.$el.find('[name=expirationCheckbox]').prop('disabled')).toEqual(true); |