summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-05 22:02:12 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-05 22:02:12 +0200
commitea72d9061758c21ec735c2fc1dcc73320854f38d (patch)
tree59e2179bca8d53b8550f5a604def6de820c99249 /core
parent94c0cc1bb335bbd82ecbc235e76e11f4fa0d84a6 (diff)
parent96deeca34d3e5cc930e171a2e3c826d53f513da1 (diff)
downloadnextcloud-server-ea72d9061758c21ec735c2fc1dcc73320854f38d.tar.gz
nextcloud-server-ea72d9061758c21ec735c2fc1dcc73320854f38d.zip
Merge pull request #19553 from owncloud/properly_format_date_shareview
Use DD-MM-YYYY consistently in share sidebar
Diffstat (limited to 'core')
-rw-r--r--core/js/sharedialogexpirationview.js7
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js13
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 b01a3d2cae6..22ae63e796a 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -311,10 +311,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);
@@ -326,8 +326,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();
@@ -345,8 +344,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);
@@ -375,8 +373,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);