diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-10-02 10:16:21 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-10-02 10:51:51 +0200 |
commit | 4b3a5a257f0861db23b8d97836afdf398b3fef9a (patch) | |
tree | 0b0274cae73c0b90c604c705cb547c6d50d0ff17 | |
parent | 3dec30d0e09128002f24f58b7ea042c42defce31 (diff) | |
download | nextcloud-server-4b3a5a257f0861db23b8d97836afdf398b3fef9a.tar.gz nextcloud-server-4b3a5a257f0861db23b8d97836afdf398b3fef9a.zip |
Fix moment.js "a few seconds ago" with "seconds ago"
* fixes #18627
-rw-r--r-- | apps/files/tests/js/mainfileinfodetailviewSpec.js | 2 | ||||
-rw-r--r-- | apps/files_versions/tests/js/versionstabviewSpec.js | 2 | ||||
-rw-r--r-- | core/js/js.js | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/apps/files/tests/js/mainfileinfodetailviewSpec.js b/apps/files/tests/js/mainfileinfodetailviewSpec.js index 2b9e2b23f93..f4403196f2e 100644 --- a/apps/files/tests/js/mainfileinfodetailviewSpec.js +++ b/apps/files/tests/js/mainfileinfodetailviewSpec.js @@ -58,7 +58,7 @@ describe('OCA.Files.MainFileInfoDetailView tests', function() { expect(view.$el.find('.fileName h3').attr('title')).toEqual('One.txt'); expect(view.$el.find('.size').text()).toEqual('117.7 MB'); expect(view.$el.find('.size').attr('title')).toEqual('123456789 bytes'); - expect(view.$el.find('.date').text()).toEqual('a few seconds ago'); + expect(view.$el.find('.date').text()).toEqual('seconds ago'); expect(view.$el.find('.date').attr('title')).toEqual(dateExpected); clock.restore(); }); diff --git a/apps/files_versions/tests/js/versionstabviewSpec.js b/apps/files_versions/tests/js/versionstabviewSpec.js index 4435f38ef7e..306dd66be2a 100644 --- a/apps/files_versions/tests/js/versionstabviewSpec.js +++ b/apps/files_versions/tests/js/versionstabviewSpec.js @@ -76,7 +76,7 @@ describe('OCA.Versions.VersionsTabView', function() { expect($versions.length).toEqual(2); var $item = $versions.eq(0); expect($item.find('.downloadVersion').attr('href')).toEqual(version1.getDownloadUrl()); - expect($item.find('.versiondate').text()).toEqual('a few seconds ago'); + expect($item.find('.versiondate').text()).toEqual('seconds ago'); expect($item.find('.revertVersion').length).toEqual(1); expect($item.find('.preview').attr('src')).toEqual(version1.getPreviewUrl()); diff --git a/core/js/js.js b/core/js/js.js index e40141ac617..36fa90e78a3 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1533,6 +1533,10 @@ OC.Util = { * @returns {string} human readable difference from now */ relativeModifiedDate: function (timestamp) { + var diff = moment().diff(moment(timestamp)); + if (diff >= 0 && diff < 45000 ) { + return t('core', 'seconds ago'); + } return moment(timestamp).fromNow(); }, /** |