mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
uploads: Display year in attachments UI upload timestamp.
Modified timerender.js absolute_time() to include the year in the returned time stamp string. Fixes #5600.
This commit is contained in:
committed by
Tim Abbott
parent
9bb0602ad4
commit
77dc5df56a
@@ -139,13 +139,13 @@ var timerender = require('js/timerender.js');
|
|||||||
|
|
||||||
// timestamp with hour > 12
|
// timestamp with hour > 12
|
||||||
var timestamp = 1555091573000; // 4/12/2019 5:52:53 PM (UTC+0)
|
var timestamp = 1555091573000; // 4/12/2019 5:52:53 PM (UTC+0)
|
||||||
var expected = 'Apr 12, 05:52 PM';
|
var expected = 'Apr 12, 2019 05:52 PM';
|
||||||
var actual = timerender.absolute_time(timestamp);
|
var actual = timerender.absolute_time(timestamp);
|
||||||
assert.equal(expected, actual);
|
assert.equal(expected, actual);
|
||||||
|
|
||||||
// timestamp with hour < 12
|
// timestamp with hour < 12
|
||||||
timestamp = 1495091573000; // 5/18/2017 7:12:53 AM (UTC+0)
|
timestamp = 1495091573000; // 5/18/2017 7:12:53 AM (UTC+0)
|
||||||
expected = 'May 18, 07:12 AM';
|
expected = 'May 18, 2017 07:12 AM';
|
||||||
actual = timerender.absolute_time(timestamp);
|
actual = timerender.absolute_time(timestamp);
|
||||||
assert.equal(expected, actual);
|
assert.equal(expected, actual);
|
||||||
}());
|
}());
|
||||||
@@ -157,13 +157,13 @@ var timerender = require('js/timerender.js');
|
|||||||
|
|
||||||
// timestamp with hour > 12
|
// timestamp with hour > 12
|
||||||
var timestamp = 1555091573000; // 4/12/2019 17:52:53 (UTC+0)
|
var timestamp = 1555091573000; // 4/12/2019 17:52:53 (UTC+0)
|
||||||
var expected = 'Apr 12, 17:52';
|
var expected = 'Apr 12, 2019 17:52';
|
||||||
var actual = timerender.absolute_time(timestamp);
|
var actual = timerender.absolute_time(timestamp);
|
||||||
assert.equal(expected, actual);
|
assert.equal(expected, actual);
|
||||||
|
|
||||||
// timestamp with hour < 12
|
// timestamp with hour < 12
|
||||||
timestamp = 1495091573000; // 5/18/2017 7:12:53 AM (UTC+0)
|
timestamp = 1495091573000; // 5/18/2017 7:12:53 AM (UTC+0)
|
||||||
expected = 'May 18, 07:12';
|
expected = 'May 18, 2017 07:12';
|
||||||
actual = timerender.absolute_time(timestamp);
|
actual = timerender.absolute_time(timestamp);
|
||||||
assert.equal(expected, actual);
|
assert.equal(expected, actual);
|
||||||
}());
|
}());
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ exports.absolute_time = (function () {
|
|||||||
var date = new Date(timestamp);
|
var date = new Date(timestamp);
|
||||||
var H_24 = page_params.twenty_four_hour_time;
|
var H_24 = page_params.twenty_four_hour_time;
|
||||||
|
|
||||||
return MONTHS[date.getMonth()] + " " + date.getDate() + ", " + fmt_time(date, H_24);
|
return MONTHS[date.getMonth()] + " " + date.getDate() + ", " + date.getFullYear() + " " + fmt_time(date, H_24);
|
||||||
};
|
};
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user