FIX: activy column title shows the non-i18n datetime

This commit is contained in:
Erick Guan 2016-11-16 21:51:08 +01:00
parent d57adfed02
commit fb3c5bcd0f
No known key found for this signature in database
GPG Key ID: 10075E9E76407351
2 changed files with 5 additions and 5 deletions

View File

@ -74,7 +74,7 @@ export function toTitleCase(str) {
export function longDate(dt) { export function longDate(dt) {
if (!dt) return; if (!dt) return;
return moment(dt).longDate(); return moment(dt).format(I18n.t("dates.long_with_year"));
} }
// suppress year, if current year // suppress year, if current year

View File

@ -1,6 +1,6 @@
var clock; var clock;
import { relativeAge, autoUpdatingRelativeAge, updateRelativeAge, breakUp, number } from 'discourse/lib/formatter'; import { relativeAge, autoUpdatingRelativeAge, updateRelativeAge, breakUp, number, longDate } from 'discourse/lib/formatter';
module("lib:formatter", { module("lib:formatter", {
setup: function() { setup: function() {
@ -72,7 +72,7 @@ test("formating medium length dates", function() {
equal(strip(formatDays(100)), shortDate(100)); // eg: Jan 23 equal(strip(formatDays(100)), shortDate(100)); // eg: Jan 23
equal(strip(formatDays(500)), shortDateYear(500)); equal(strip(formatDays(500)), shortDateYear(500));
equal($(formatDays(0)).attr("title"), moment().format('MMMM D, YYYY h:mma')); equal($(formatDays(0)).attr("title"), longDate(new Date()));
equal($(formatDays(0)).attr("class"), "date"); equal($(formatDays(0)).attr("class"), "date");
clock.restore(); clock.restore();
@ -157,12 +157,12 @@ test("autoUpdatingRelativeAge", function() {
equal($elem.attr('title'), undefined); equal($elem.attr('title'), undefined);
$elem = $(autoUpdatingRelativeAge(d, {title: true})); $elem = $(autoUpdatingRelativeAge(d, {title: true}));
equal($elem.attr('title'), moment(d).longDate()); equal($elem.attr('title'), longDate(d));
$elem = $(autoUpdatingRelativeAge(d,{format: 'medium', title: true, leaveAgo: true})); $elem = $(autoUpdatingRelativeAge(d,{format: 'medium', title: true, leaveAgo: true}));
equal($elem.data('format'), "medium-with-ago"); equal($elem.data('format'), "medium-with-ago");
equal($elem.data('time'), d.getTime()); equal($elem.data('time'), d.getTime());
equal($elem.attr('title'), moment(d).longDate()); equal($elem.attr('title'), longDate(d));
equal($elem.html(), '1 day ago'); equal($elem.html(), '1 day ago');
$elem = $(autoUpdatingRelativeAge(d,{format: 'medium'})); $elem = $(autoUpdatingRelativeAge(d,{format: 'medium'}));