mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: Error in smart short date function
This commit is contained in:
parent
1643ff0f3c
commit
90330d30f4
2 changed files with 3 additions and 4 deletions
|
@ -56,8 +56,8 @@ function shortDateNoYear(date) {
|
|||
}
|
||||
|
||||
// Suppress year if it's this year
|
||||
export function smartShortDate(date) {
|
||||
return (date.getFullYear() === new Date().getFullYear()) ? shortDateNoYear(date) : tinyDateYear(date);
|
||||
export function smartShortDate(date, withYear=tinyDateYear) {
|
||||
return (date.getFullYear() === new Date().getFullYear()) ? shortDateNoYear(date) : withYear(date);
|
||||
}
|
||||
|
||||
export function tinyDateYear(date) {
|
||||
|
@ -220,7 +220,7 @@ function relativeAgeMedium(date, options) {
|
|||
if (distance < oneMinuteAgo) {
|
||||
displayDate = I18n.t("now");
|
||||
} else if (distance > fiveDaysAgo) {
|
||||
displayDate = smartShortDate(date);
|
||||
displayDate = smartShortDate(date, shortDate);
|
||||
} else {
|
||||
displayDate = relativeAgeMediumSpan(distance, leaveAgo);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,6 @@ test("formating medium length dates", function() {
|
|||
|
||||
equal(strip(formatDays(8)), shortDate(8));
|
||||
equal(strip(formatDays(10)), shortDateYear(10));
|
||||
|
||||
});
|
||||
|
||||
test("formating tiny dates", function() {
|
||||
|
|
Loading…
Reference in a new issue