From b5d0031105387236801dccddc9ab494d7fc938be Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 29 Jan 2014 15:45:06 -0500 Subject: [PATCH] Topic list dates formatting changes: use Dec '12 and Jan 21 --- app/assets/javascripts/discourse/lib/formatter.js | 4 ++-- config/locales/client.cs.yml | 3 ++- config/locales/client.da.yml | 2 ++ config/locales/client.de.yml | 3 ++- config/locales/client.en.yml | 3 ++- config/locales/client.es.yml | 3 ++- config/locales/client.fr.yml | 3 ++- config/locales/client.it.yml | 3 ++- config/locales/client.ja.yml | 3 ++- config/locales/client.ko.yml | 1 + config/locales/client.nl.yml | 3 ++- config/locales/client.pseudo.yml | 2 ++ config/locales/client.pt_BR.yml | 3 ++- config/locales/client.ru.yml | 3 ++- config/locales/client.sv.yml | 3 ++- config/locales/client.zh_CN.yml | 1 + config/locales/client.zh_TW.yml | 2 ++ test/javascripts/lib/formatter_test.js | 6 +++--- 18 files changed, 35 insertions(+), 16 deletions(-) diff --git a/app/assets/javascripts/discourse/lib/formatter.js b/app/assets/javascripts/discourse/lib/formatter.js index c9b0fda1ae..9303d63b95 100644 --- a/app/assets/javascripts/discourse/lib/formatter.js +++ b/app/assets/javascripts/discourse/lib/formatter.js @@ -96,7 +96,7 @@ Discourse.Formatter = (function(){ }; shortDateNoYear = function(date) { - return moment(date).shortDateNoYear(); + return moment(date).format(I18n.t("dates.tiny.date_month")); }; tinyDateYear = function(date) { @@ -261,7 +261,7 @@ Discourse.Formatter = (function(){ if ((new Date()).getFullYear() !== date.getFullYear()) { displayDate = shortDate(date); } else { - displayDate = moment(date).shortDateNoYear(); + displayDate = shortDateNoYear(date); } } else { displayDate = relativeAgeMediumSpan(distance, leaveAgo); diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml index b5d108f286..62cb061317 100644 --- a/config/locales/client.cs.yml +++ b/config/locales/client.cs.yml @@ -59,7 +59,8 @@ cs: one: "1r" few: "%{count}r" other: "%{count}let" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 minuta" diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml index 1f50a22f4f..4423b7ec7e 100644 --- a/config/locales/client.da.yml +++ b/config/locales/client.da.yml @@ -49,6 +49,8 @@ da: almost_x_years: one: "1å" other: "%{count}å" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 min" diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index 29f91d27f9..6a2f878cfe 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -49,7 +49,8 @@ de: almost_x_years: one: "1J" other: "%{count}J" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 Minute" diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 8cd8eac1cf..8ddc9b24fc 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -49,7 +49,8 @@ en: almost_x_years: one: "1y" other: "%{count}y" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 min" diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml index 2b6771bfe5..8869a2f4de 100644 --- a/config/locales/client.es.yml +++ b/config/locales/client.es.yml @@ -51,7 +51,8 @@ es: almost_x_years: one: "1a" other: "%{count}a" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 minuto" diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml index 93dbf38176..c5a009596a 100644 --- a/config/locales/client.fr.yml +++ b/config/locales/client.fr.yml @@ -53,7 +53,8 @@ fr: almost_x_years: one: "1y" other: "%{count}a" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 min" diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml index 893445c901..67108b04c2 100644 --- a/config/locales/client.it.yml +++ b/config/locales/client.it.yml @@ -49,7 +49,8 @@ it: almost_x_years: one: "1a" other: "%{count}a" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 minuto" diff --git a/config/locales/client.ja.yml b/config/locales/client.ja.yml index 5554cb3337..9ea4feb09a 100644 --- a/config/locales/client.ja.yml +++ b/config/locales/client.ja.yml @@ -49,7 +49,8 @@ ja: almost_x_years: one: "1y" other: "%{count}y" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1分" diff --git a/config/locales/client.ko.yml b/config/locales/client.ko.yml index c42ac814fa..e945ea57f2 100644 --- a/config/locales/client.ko.yml +++ b/config/locales/client.ko.yml @@ -50,6 +50,7 @@ ko: one: "거의 1년" other: "거의 %{count}년" date_year: "'YY M/D" + date_month: "MMM D" medium: x_minutes: one: "1분" diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml index 213e112563..513689274d 100644 --- a/config/locales/client.nl.yml +++ b/config/locales/client.nl.yml @@ -53,7 +53,8 @@ nl: almost_x_years: one: 1j other: "%{count}j" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: 1 min diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml index 758df67f21..9d1411cad5 100644 --- a/config/locales/client.pseudo.yml +++ b/config/locales/client.pseudo.yml @@ -43,6 +43,8 @@ pseudo: almost_x_years: one: '[[ 1ý ]]' other: '[[ %{count}ý ]]' + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: '[[ 1 ɱíɳ ]]' diff --git a/config/locales/client.pt_BR.yml b/config/locales/client.pt_BR.yml index acd3ee20b2..e7fb44885c 100644 --- a/config/locales/client.pt_BR.yml +++ b/config/locales/client.pt_BR.yml @@ -49,7 +49,8 @@ pt_BR: almost_x_years: one: "1y" other: "%{count}y" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 minuto" diff --git a/config/locales/client.ru.yml b/config/locales/client.ru.yml index 4a5792fe85..a18b3b12de 100644 --- a/config/locales/client.ru.yml +++ b/config/locales/client.ru.yml @@ -72,7 +72,8 @@ ru: other: '%{count}лет' few: '%{count}лет' many: '%{count}лет' - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: '1 минута' diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index 0eab645120..0b26075922 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -49,7 +49,8 @@ sv: almost_x_years: one: "1y" other: "%{count}y" - date_year: "D MMM 'YY" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 min" diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml index a061d5a7ba..0cc6afcf0e 100644 --- a/config/locales/client.zh_CN.yml +++ b/config/locales/client.zh_CN.yml @@ -49,6 +49,7 @@ zh_CN: almost_x_years: one: "1年" other: "%{count}年" + date_month: "MMM-D" date_year: "YY-MM-D" medium: x_minutes: diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml index 5fbc128e1c..f4ce51dbbc 100644 --- a/config/locales/client.zh_TW.yml +++ b/config/locales/client.zh_TW.yml @@ -49,6 +49,8 @@ zh_TW: almost_x_years: one: "1 年" other: "%{count} 年" + date_month: "MMM D" + date_year: "MMM 'YY" medium: x_minutes: one: "1 分鐘" diff --git a/test/javascripts/lib/formatter_test.js b/test/javascripts/lib/formatter_test.js index 531ea2280e..c64d56713c 100644 --- a/test/javascripts/lib/formatter_test.js +++ b/test/javascripts/lib/formatter_test.js @@ -29,7 +29,7 @@ var formatDays = function(days) { }; var shortDate = function(days){ - return moment().subtract('days', days).format('D MMM'); + return moment().subtract('days', days).format('MMM D'); }; test("formating medium length dates", function() { @@ -65,7 +65,7 @@ test("formating medium length dates", function() { equal(strip(formatDays(4.85)), "4 days"); equal(strip(formatDays(6)), shortDate(6)); - equal(strip(formatDays(100)), shortDate(100)); // eg: 23 Jan + equal(strip(formatDays(100)), shortDate(100)); // eg: Jan 23 equal(strip(formatDays(500)), shortDateYear(500)); equal($(formatDays(0)).attr("title"), moment().format('MMMM D, YYYY h:mma')); @@ -81,7 +81,7 @@ test("formating medium length dates", function() { test("formating tiny dates", function() { var shortDateYear = function(days){ - return moment().subtract('days', days).format("D MMM 'YY"); + return moment().subtract('days', days).format("MMM 'YY"); }; format = "tiny";