Merge pull request #2706 from techAPJ/patch-2
FIX: use short date format for timestamp
This commit is contained in:
commit
b3d896723b
|
@ -162,7 +162,7 @@ Handlebars.registerHelper('raw-date', function(property, options) {
|
|||
@for Handlebars
|
||||
**/
|
||||
Em.Handlebars.helper('bound-raw-date', function (date) {
|
||||
return Discourse.Formatter.longDate(new Date(date));
|
||||
return Discourse.Formatter.longDateNoYear(new Date(date));
|
||||
});
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* global BreakString:true */
|
||||
|
||||
var updateRelativeAge, autoUpdatingRelativeAge, relativeAge, relativeAgeTiny,
|
||||
relativeAgeMedium, relativeAgeMediumSpan, longDate, toTitleCase,
|
||||
relativeAgeMedium, relativeAgeMediumSpan, longDate, longDateNoYear, toTitleCase,
|
||||
shortDate, shortDateNoYear, tinyDateYear, relativeAgeTinyShowsYear;
|
||||
|
||||
/*
|
||||
|
@ -75,6 +75,17 @@ longDate = function(dt) {
|
|||
return moment(dt).longDate();
|
||||
};
|
||||
|
||||
// suppress year, if current year
|
||||
longDateNoYear = function(dt) {
|
||||
if (!dt) return;
|
||||
|
||||
if ((new Date()).getFullYear() !== dt.getFullYear()) {
|
||||
return moment(dt).format("MMM D, 'YY LT");
|
||||
} else {
|
||||
return moment(dt).format("MMM D, LT");
|
||||
}
|
||||
};
|
||||
|
||||
updateRelativeAge = function(elems) {
|
||||
// jQuery .each
|
||||
elems.each(function(){
|
||||
|
@ -258,6 +269,7 @@ var number = function(val) {
|
|||
|
||||
Discourse.Formatter = {
|
||||
longDate: longDate,
|
||||
longDateNoYear: longDateNoYear,
|
||||
relativeAge: relativeAge,
|
||||
autoUpdatingRelativeAge: autoUpdatingRelativeAge,
|
||||
updateRelativeAge: updateRelativeAge,
|
||||
|
|
Loading…
Reference in New Issue