summaryrefslogtreecommitdiffstats
path: root/apps/files/js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-13 10:07:10 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-13 10:07:10 +0100
commit5b3971f002abf3a5f94f738eb189567110841574 (patch)
treeaf14ef772230e31ad1c61261654a46df17661688 /apps/files/js
parent29e1c3a898a66b0b005d230a836a0275e462071c (diff)
parentfdbb68a3c3aa6c6cf6ae5c440dd7b742076f1184 (diff)
downloadnextcloud-server-5b3971f002abf3a5f94f738eb189567110841574.tar.gz
nextcloud-server-5b3971f002abf3a5f94f738eb189567110841574.zip
Merge pull request #12639 from owncloud/bad_mtime_format
Fix formatting of bad dates from external storages
Diffstat (limited to 'apps/files/js')
-rw-r--r--apps/files/js/filelist.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index b20bdf23e1f..b4702ce4f2b 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -649,12 +649,16 @@
icon = OC.Util.replaceSVGIcon(fileData.icon),
name = fileData.name,
type = fileData.type || 'file',
- mtime = parseInt(fileData.mtime, 10) || new Date().getTime(),
+ mtime = parseInt(fileData.mtime, 10),
mime = fileData.mimetype,
path = fileData.path,
linkUrl;
options = options || {};
+ if (isNaN(mtime)) {
+ mtime = new Date().getTime()
+ }
+
if (type === 'dir') {
mime = mime || 'httpd/unix-directory';
}
@@ -771,12 +775,21 @@
if (modifiedColor >= '160') {
modifiedColor = 160;
}
+ var formatted;
+ var text;
+ if (mtime > 0) {
+ formatted = formatDate(mtime);
+ text = OC.Util.relativeModifiedDate(mtime);
+ } else {
+ formatted = t('files', 'Unable to determine date');
+ text = '?';
+ }
td = $('<td></td>').attr({ "class": "date" });
td.append($('<span></span>').attr({
"class": "modified",
- "title": formatDate(mtime),
+ "title": formatted,
"style": 'color:rgb('+modifiedColor+','+modifiedColor+','+modifiedColor+')'
- }).text(OC.Util.relativeModifiedDate(mtime)));
+ }).text(text));
tr.find('.filesize').text(simpleSize);
tr.append(td);
return tr;