]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Standardize CJK time formats.
authorJason Katz-Brown <jason@airbnb.com>
Tue, 15 Nov 2016 08:15:19 +0000 (01:15 -0700)
committerIskren Chernev <iskren.chernev@gmail.com>
Thu, 2 Mar 2017 08:40:17 +0000 (10:40 +0200)
Times like '16:30' are predominant on China, Taiwan, Hong Kong, Japan
and Korea websites. For example, all of Facebook's CJK locales format
times like '16:30'.

This change also removes an inconsistency in 'calendar' between zh-cn
and the two other zh locales (zh-hk and zh-tw). Now 'calendar' will
refer to days in the current week in the same way across these three
locales.

src/locale/ja.js
src/locale/ko.js
src/locale/zh-cn.js
src/locale/zh-hk.js
src/locale/zh-tw.js
src/test/locale/ja.js
src/test/locale/ko.js
src/test/locale/zh-cn.js
src/test/locale/zh-hk.js
src/test/locale/zh-tw.js

index 38a262ed3dc297769ac03381c40d2f0704b38ada..6b21804896d84eacdc00dea74759ce67c2a6ceb2 100644 (file)
@@ -11,12 +11,16 @@ export default moment.defineLocale('ja', {
     weekdaysShort : '日_月_火_水_木_金_土'.split('_'),
     weekdaysMin : '日_月_火_水_木_金_土'.split('_'),
     longDateFormat : {
-        LT : 'Ah時m分',
-        LTS : 'Ah時m分s秒',
+        LT : 'HH:mm',
+        LTS : 'HH:mm:ss',
         L : 'YYYY/MM/DD',
         LL : 'YYYY年M月D日',
-        LLL : 'YYYY年M月D日Ah時m分',
-        LLLL : 'YYYY年M月D日Ah時m分 dddd'
+        LLL : 'YYYY年M月D日 HH:mm',
+        LLLL : 'YYYY年M月D日 HH:mm dddd',
+        l : 'YYYY/MM/DD',
+        ll : 'YYYY年M月D日',
+        lll : 'YYYY年M月D日 HH:mm',
+        llll : 'YYYY年M月D日 HH:mm dddd'
     },
     meridiemParse: /午前|午後/i,
     isPM : function (input) {
index 8df73a453984508a2d2306555db943c9764e60de..e84799307f52ea6e118e56669a0890d7e3320601 100644 (file)
@@ -12,12 +12,16 @@ export default moment.defineLocale('ko', {
     weekdaysShort : '일_월_화_수_목_금_토'.split('_'),
     weekdaysMin : '일_월_화_수_목_금_토'.split('_'),
     longDateFormat : {
-        LT : 'A h시 m분',
-        LTS : 'A h시 m분 s초',
+        LT : 'HH:mm',
+        LTS : 'HH:mm:ss',
         L : 'YYYY.MM.DD',
         LL : 'YYYY년 MMMM D일',
-        LLL : 'YYYY년 MMMM D일 A h시 m분',
-        LLLL : 'YYYY년 MMMM D일 dddd A h시 m분'
+        LLL : 'YYYY년 MMMM D일 HH:mm',
+        LLLL : 'YYYY년 MMMM D일 dddd HH:mm',
+        l : 'YYYY.MM.DD',
+        ll : 'YYYY년 MMMM D일',
+        lll : 'YYYY년 MMMM D일 HH:mm',
+        llll : 'YYYY년 MMMM D일 dddd HH:mm'
     },
     calendar : {
         sameDay : '오늘 LT',
index 031c50e664685cf5f7dc1d765ac0ed2245d7d72a..ad7ac88509569504cecd567798c7629f8dbc917b 100644 (file)
@@ -12,16 +12,16 @@ export default moment.defineLocale('zh-cn', {
     weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
     weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
     longDateFormat : {
-        LT : 'Ah点mm分',
-        LTS : 'Ah点m分s秒',
-        L : 'YYYY-MM-DD',
+        LT : 'HH:mm',
+        LTS : 'HH:mm:ss',
+        L : 'YYYY年MMMD日',
         LL : 'YYYY年MMMD日',
-        LLL : 'YYYY年MMMD日Ah点mm分',
-        LLLL : 'YYYY年MMMD日ddddAh点mm分',
-        l : 'YYYY-MM-DD',
+        LLL : 'YYYY年MMMD日 HH:mm',
+        LLLL : 'YYYY年MMMD日dddd HH:mm',
+        l : 'YYYY年MMMD日',
         ll : 'YYYY年MMMD日',
-        lll : 'YYYY年MMMD日Ah点mm分',
-        llll : 'YYYY年MMMD日ddddAh点mm分'
+        lll : 'YYYY年MMMD日 HH:mm',
+        llll : 'YYYY年MMMD日dddd HH:mm'
     },
     meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
     meridiemHour: function (hour, meridiem) {
@@ -55,28 +55,12 @@ export default moment.defineLocale('zh-cn', {
         }
     },
     calendar : {
-        sameDay : function () {
-            return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
-        },
-        nextDay : function () {
-            return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
-        },
-        lastDay : function () {
-            return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
-        },
-        nextWeek : function () {
-            var startOfWeek, prefix;
-            startOfWeek = moment().startOf('week');
-            prefix = this.diff(startOfWeek, 'days') >= 7 ? '[下]' : '[本]';
-            return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
-        },
-        lastWeek : function () {
-            var startOfWeek, prefix;
-            startOfWeek = moment().startOf('week');
-            prefix = this.unix() < startOfWeek.unix()  ? '[上]' : '[本]';
-            return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
-        },
-        sameElse : 'LL'
+        sameDay : '[今天]LT',
+        nextDay : '[明天]LT',
+        nextWeek : '[下]ddddLT',
+        lastDay : '[昨天]LT',
+        lastWeek : '[上]ddddLT',
+        sameElse : 'L'
     },
     ordinalParse: /\d{1,2}(日|月|周)/,
     ordinal : function (number, period) {
index 51d385d89afc1d53ba5b38c472deb90320bf14cc..f8bf2d1da5ef79d62659bb5ed13d0e70672b123d 100644 (file)
@@ -13,16 +13,16 @@ export default moment.defineLocale('zh-hk', {
     weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'),
     weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
     longDateFormat : {
-        LT : 'Ah點mm分',
-        LTS : 'Ah點m分s秒',
+        LT : 'HH:mm',
+        LTS : 'HH:mm:ss',
         L : 'YYYY年MMMD日',
         LL : 'YYYY年MMMD日',
-        LLL : 'YYYY年MMMD日Ah點mm分',
-        LLLL : 'YYYY年MMMD日ddddAh點mm分',
+        LLL : 'YYYY年MMMD日 HH:mm',
+        LLLL : 'YYYY年MMMD日dddd HH:mm',
         l : 'YYYY年MMMD日',
         ll : 'YYYY年MMMD日',
-        lll : 'YYYY年MMMD日Ah點mm分',
-        llll : 'YYYY年MMMD日ddddAh點mm分'
+        lll : 'YYYY年MMMD日 HH:mm',
+        llll : 'YYYY年MMMD日dddd HH:mm'
     },
     meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
     meridiemHour : function (hour, meridiem) {
index 577d61eb59f6765c493da43086417327ccc43127..fba8a80152f6af4592771a91b4d7b40de65e4570 100644 (file)
@@ -12,16 +12,16 @@ export default moment.defineLocale('zh-tw', {
     weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'),
     weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
     longDateFormat : {
-        LT : 'Ah點mm分',
-        LTS : 'Ah點m分s秒',
+        LT : 'HH:mm',
+        LTS : 'HH:mm:ss',
         L : 'YYYY年MMMD日',
         LL : 'YYYY年MMMD日',
-        LLL : 'YYYY年MMMD日Ah點mm分',
-        LLLL : 'YYYY年MMMD日ddddAh點mm分',
+        LLL : 'YYYY年MMMD日 HH:mm',
+        LLLL : 'YYYY年MMMD日dddd HH:mm',
         l : 'YYYY年MMMD日',
         ll : 'YYYY年MMMD日',
-        lll : 'YYYY年MMMD日Ah點mm分',
-        llll : 'YYYY年MMMD日ddddAh點mm分'
+        lll : 'YYYY年MMMD日 HH:mm',
+        llll : 'YYYY年MMMD日dddd HH:mm'
     },
     meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
     meridiemHour : function (hour, meridiem) {
index 76f1b6885c4024403dbde0be5738c7ba246047bd..2435e13a133176b6091bd6ab369974c2164859cd 100644 (file)
@@ -36,15 +36,15 @@ test('format', function (assert) {
             ['s ss',                               '50 50'],
             ['a A',                                '午後 午後'],
             ['[the] DDDo [day of the year]',       'the 45日 day of the year'],
-            ['LTS',                                '午後3時25分50秒'],
+            ['LTS',                                '15:25:50'],
             ['L',                                  '2010/02/14'],
             ['LL',                                 '2010年2月14日'],
-            ['LLL',                                '2010年2月14日午後3時25分'],
-            ['LLLL',                               '2010年2月14日午後3時25分 日曜日'],
-            ['l',                                  '2010/2/14'],
+            ['LLL',                                '2010年2月14日 15:25'],
+            ['LLLL',                               '2010年2月14日 15:25 日曜日'],
+            ['l',                                  '2010/02/14'],
             ['ll',                                 '2010年2月14日'],
-            ['lll',                                '2010年2月14日午後3時25分'],
-            ['llll',                               '2010年2月14日午後3時25分 日']
+            ['lll',                                '2010年2月14日 15:25'],
+            ['llll',                               '2010年2月14日 15:25 日曜日']
         ],
         b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
         i;
@@ -116,12 +116,12 @@ test('fromNow', function (assert) {
 test('calendar day', function (assert) {
     var a = moment().hours(12).minutes(0).seconds(0);
 
-    assert.equal(moment(a).calendar(),                   '今日 午後12時0分',     'today at the same time');
-    assert.equal(moment(a).add({m: 25}).calendar(),      '今日 午後12時25分',    'Now plus 25 min');
-    assert.equal(moment(a).add({h: 1}).calendar(),       '今日 午後1時0分',      'Now plus 1 hour');
-    assert.equal(moment(a).add({d: 1}).calendar(),       '明日 午後12時0分',     'tomorrow at the same time');
-    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今日 午前11時0分',     'Now minus 1 hour');
-    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨日 午後12時0分',     'yesterday at the same time');
+    assert.equal(moment(a).calendar(),                   '今日 12:00', 'today at the same time');
+    assert.equal(moment(a).add({m: 25}).calendar(),      '今日 12:25', 'Now plus 25 min');
+    assert.equal(moment(a).add({h: 1}).calendar(),       '今日 13:00', 'Now plus 1 hour');
+    assert.equal(moment(a).add({d: 1}).calendar(),       '明日 12:00', 'tomorrow at the same time');
+    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今日 11:00', 'Now minus 1 hour');
+    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨日 12:00', 'yesterday at the same time');
 });
 
 test('calendar next week', function (assert) {
index 443e51d5273bd6e4951eb6799d9b58e152738491..0b71d5bae341fd9fb65783aa82571a4106803e4d 100644 (file)
@@ -71,15 +71,15 @@ test('format', function (assert) {
             ['s ss',                               '50 50'],
             ['a A',                                '오후 오후'],
             ['일년 중 DDDo째 되는 날',                 '일년 중 45일째 되는 날'],
-            ['LTS',                                '오후 3시 25분 50초'],
+            ['LTS',                                '15:25:50'],
             ['L',                                  '2010.02.14'],
             ['LL',                                 '2010년 2월 14일'],
-            ['LLL',                                '2010년 2월 14일 오후 3시 25분'],
-            ['LLLL',                               '2010년 2월 14일 일요일 오후 3시 25분'],
-            ['l',                                  '2010.2.14'],
+            ['LLL',                                '2010년 2월 14일 15:25'],
+            ['LLLL',                               '2010년 2월 14일 일요일 15:25'],
+            ['l',                                  '2010.02.14'],
             ['ll',                                 '2010년 2월 14일'],
-            ['lll',                                '2010년 2월 14일 오후 3시 25분'],
-            ['llll',                               '2010년 2월 14일 일 오후 3시 25분']
+            ['lll',                                '2010년 2월 14일 15:25'],
+            ['llll',                               '2010년 2월 14일 일요일 15:25']
         ],
         b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
         i;
@@ -188,12 +188,12 @@ test('fromNow', function (assert) {
 test('calendar day', function (assert) {
     var a = moment().hours(12).minutes(0).seconds(0);
 
-    assert.equal(moment(a).calendar(),                   '오늘 오후 12시 0분',     'today at the same time');
-    assert.equal(moment(a).add({m: 25}).calendar(),      '오늘 오후 12시 25분',    'Now plus 25 min');
-    assert.equal(moment(a).add({h: 1}).calendar(),       '오늘 오후 1시 0분',      'Now plus 1 hour');
-    assert.equal(moment(a).add({d: 1}).calendar(),       '내일 오후 12시 0분',     'tomorrow at the same time');
-    assert.equal(moment(a).subtract({h: 1}).calendar(),  '오늘 오전 11시 0분',     'Now minus 1 hour');
-    assert.equal(moment(a).subtract({d: 1}).calendar(),  '어제 오후 12시 0분',     'yesterday at the same time');
+    assert.equal(moment(a).calendar(),                   '오늘 12:00', 'today at the same time');
+    assert.equal(moment(a).add({m: 25}).calendar(),      '오늘 12:25', 'Now plus 25 min');
+    assert.equal(moment(a).add({h: 1}).calendar(),       '오늘 13:00', 'Now plus 1 hour');
+    assert.equal(moment(a).add({d: 1}).calendar(),       '내일 12:00', 'tomorrow at the same time');
+    assert.equal(moment(a).subtract({h: 1}).calendar(),  '오늘 11:00', 'Now minus 1 hour');
+    assert.equal(moment(a).subtract({d: 1}).calendar(),  '어제 12:00', 'yesterday at the same time');
 });
 
 test('calendar next week', function (assert) {
index 86a66219dbe5d7274593e969012790af0a75267c..5951dc87711d93215206dff5332f1833729bcba4 100644 (file)
@@ -38,15 +38,15 @@ test('format', function (assert) {
             ['s ss',                               '50 50'],
             ['a A',                                '下午 下午'],
             ['[这年的第] DDDo',                    '这年的第 45日'],
-            ['LTS',                                '下午3点25分50秒'],
-            ['L',                                  '2010-02-14'],
+            ['LTS',                                '15:25:50'],
+            ['L',                                  '2010年2月14日'],
             ['LL',                                 '2010年2月14日'],
-            ['LLL',                                '2010年2月14日下午3点25分'],
-            ['LLLL',                               '2010年2月14日星期日下午3点25分'],
-            ['l',                                  '2010-02-14'],
+            ['LLL',                                '2010年2月14日 15:25'],
+            ['LLLL',                               '2010年2月14日星期日 15:25'],
+            ['l',                                  '2010年2月14日'],
             ['ll',                                 '2010年2月14日'],
-            ['lll',                                '2010年2月14日下午3点25分'],
-            ['llll',                               '2010年2月14日星期日下午3点25分']
+            ['lll',                                '2010年2月14日 15:25'],
+            ['llll',                               '2010年2月14日星期日 15:25']
         ],
         b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
         i;
@@ -121,70 +121,50 @@ test('fromNow', function (assert) {
 test('calendar day', function (assert) {
     var a = moment().hours(12).minutes(0).seconds(0);
 
-    assert.equal(moment(a).calendar(),                   '今天中午12点整',     'today at the same time');
-    assert.equal(moment(a).add({m: 25}).calendar(),      '今天中午12点25分',   'Now plus 25 min');
-    assert.equal(moment(a).add({h: 1}).calendar(),       '今天下午1点整',      'Now plus 1 hour');
-    assert.equal(moment(a).add({d: 1}).calendar(),       '明天中午12点整',     'tomorrow at the same time');
-    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今天上午11点整',     'Now minus 1 hour');
-    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨天中午12点整',     'yesterday at the same time');
-});
-
-test('calendar current week', function (assert) {
-    var i, m,
-        today = moment().startOf('day');
-
-    for (i = 0; i < 7; i++) {
-        m = moment().startOf('week').add({d: i});
-        if (Math.abs(m.diff(today, 'days')) <= 1) {
-            continue; // skip today, yesterday, tomorrow
-        }
-        assert.equal(m.calendar(),       m.format('[本]ddd凌晨12点整'),  'Monday + ' + i + ' days current time');
-    }
+    assert.equal(moment(a).calendar(),                   '今天12:00', 'today at the same time');
+    assert.equal(moment(a).add({m: 25}).calendar(),      '今天12:25', 'Now plus 25 min');
+    assert.equal(moment(a).add({h: 1}).calendar(),       '今天13:00', 'Now plus 1 hour');
+    assert.equal(moment(a).add({d: 1}).calendar(),       '明天12:00', 'tomorrow at the same time');
+    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今天11:00', 'Now minus 1 hour');
+    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨天12:00', 'yesterday at the same time');
 });
 
 test('calendar next week', function (assert) {
-    var i, m,
-        today = moment().startOf('day');
-
-    for (i = 7; i < 14; i++) {
-        m = moment().startOf('week').add({d: i});
-        if (Math.abs(m.diff(today, 'days')) >= 7) {
-            continue;
-        }
-        if (Math.abs(m.diff(today, 'days')) <= 1) {
-            continue; // skip today, yesterday, tomorrow
-        }
-        assert.equal(m.calendar(),  m.format('[下]ddd凌晨12点整'), 'Today + ' + i + ' days beginning of day');
+    var i, m;
+    for (i = 2; i < 7; i++) {
+        m = moment().add({d: i});
+        assert.equal(m.calendar(),       m.format('[下]ddddLT'),  'Today + ' + i + ' days current time');
+        m.hours(0).minutes(0).seconds(0).milliseconds(0);
+        assert.equal(m.calendar(),       m.format('[下]ddddLT'),  'Today + ' + i + ' days beginning of day');
+        m.hours(23).minutes(59).seconds(59).milliseconds(999);
+        assert.equal(m.calendar(),       m.format('[下]ddddLT'),  'Today + ' + i + ' days end of day');
     }
-    assert.equal(42, 42, 'at least one assert');
 });
 
 test('calendar last week', function (assert) {
-    var i, m,
-        today = moment().startOf('day');
-
-    for (i = 1; i < 8; i++) {
-        m = moment().startOf('week').subtract({d: i});
-        if ((Math.abs(m.diff(today, 'days')) >= 7) || (Math.abs(m.diff(today, 'days')) <= 1)) {
-            continue;
-        }
-        assert.equal(m.calendar(),  m.format('[上]ddd凌晨12点整'),  'Monday - ' + i + ' days next week');
+    var i, m;
+    for (i = 2; i < 7; i++) {
+        m = moment().subtract({d: i});
+        assert.equal(m.calendar(),       m.format('[上]ddddLT'),  'Today - ' + i + ' days current time');
+        m.hours(0).minutes(0).seconds(0).milliseconds(0);
+        assert.equal(m.calendar(),       m.format('[上]ddddLT'),  'Today - ' + i + ' days beginning of day');
+        m.hours(23).minutes(59).seconds(59).milliseconds(999);
+        assert.equal(m.calendar(),       m.format('[上]ddddLT'),  'Today - ' + i + ' days end of day');
     }
-    assert.equal(42, 42, 'at least one assert');
 });
 
 test('calendar all else', function (assert) {
     var weeksAgo = moment().subtract({w: 1}),
         weeksFromNow = moment().add({w: 1});
 
-    assert.equal(weeksAgo.calendar(),       weeksAgo.format('LL'),      '1 week ago');
-    assert.equal(weeksFromNow.calendar(),   weeksFromNow.format('LL'),  'in 1 week');
+    assert.equal(weeksAgo.calendar(),       weeksAgo.format('L'),      '1 week ago');
+    assert.equal(weeksFromNow.calendar(),   weeksFromNow.format('L'),  'in 1 week');
 
     weeksAgo = moment().subtract({w: 2});
     weeksFromNow = moment().add({w: 2});
 
-    assert.equal(weeksAgo.calendar(),       weeksAgo.format('LL'),      '2 weeks ago');
-    assert.equal(weeksFromNow.calendar(),   weeksFromNow.format('LL'),  'in 2 weeks');
+    assert.equal(weeksAgo.calendar(),       weeksAgo.format('L'),      '2 weeks ago');
+    assert.equal(weeksFromNow.calendar(),   weeksFromNow.format('L'),  'in 2 weeks');
 });
 
 test('meridiem', function (assert) {
index 20c90fa741c494ffcd5f49bdd4cafe872d0bd46c..903d932c996179527ffff15f76f6c03d7d0a8d57 100644 (file)
@@ -36,15 +36,15 @@ test('format', function (assert) {
             ['s ss',                               '50 50'],
             ['a A',                                '下午 下午'],
             ['[這年的第] DDDo',                    '這年的第 45日'],
-            ['LTS',                                '下午3點25分50秒'],
+            ['LTS',                                '15:25:50'],
             ['L',                                  '2010年2月14日'],
             ['LL',                                 '2010年2月14日'],
-            ['LLL',                                '2010年2月14日下午3點25分'],
-            ['LLLL',                               '2010年2月14日星期日下午3點25分'],
+            ['LLL',                                '2010年2月14日 15:25'],
+            ['LLLL',                               '2010年2月14日星期日 15:25'],
             ['l',                                  '2010年2月14日'],
             ['ll',                                 '2010年2月14日'],
-            ['lll',                                '2010年2月14日下午3點25分'],
-            ['llll',                               '2010年2月14日星期日下午3點25分']
+            ['lll',                                '2010年2月14日 15:25'],
+            ['llll',                               '2010年2月14日星期日 15:25']
         ],
         b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
         i;
@@ -119,12 +119,12 @@ test('fromNow', function (assert) {
 test('calendar day', function (assert) {
     var a = moment().hours(12).minutes(0).seconds(0);
 
-    assert.equal(moment(a).calendar(),                   '今天中午12點00分',     'today at the same time');
-    assert.equal(moment(a).add({m: 25}).calendar(),      '今天中午12點25分',     'Now plus 25 min');
-    assert.equal(moment(a).add({h: 1}).calendar(),       '今天下午1點00分',     'Now plus 1 hour');
-    assert.equal(moment(a).add({d: 1}).calendar(),       '明天中午12點00分',     'tomorrow at the same time');
-    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今天上午11點00分',     'Now minus 1 hour');
-    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨天中午12點00分',     'yesterday at the same time');
+    assert.equal(moment(a).calendar(),                   '今天12:00', 'today at the same time');
+    assert.equal(moment(a).add({m: 25}).calendar(),      '今天12:25', 'Now plus 25 min');
+    assert.equal(moment(a).add({h: 1}).calendar(),       '今天13:00', 'Now plus 1 hour');
+    assert.equal(moment(a).add({d: 1}).calendar(),       '明天12:00', 'tomorrow at the same time');
+    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今天11:00', 'Now minus 1 hour');
+    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨天12:00', 'yesterday at the same time');
 });
 
 test('calendar next week', function (assert) {
index 82c65e14a324a97e93de28788f4c085b39bd5b34..4cd415c3d5d07368ca776a7d84d1fd742aaaa519 100644 (file)
@@ -36,15 +36,15 @@ test('format', function (assert) {
             ['s ss',                               '50 50'],
             ['a A',                                '下午 下午'],
             ['[這年的第] DDDo',                    '這年的第 45日'],
-            ['LTS',                                '下午3點25分50秒'],
+            ['LTS',                                '15:25:50'],
             ['L',                                  '2010年2月14日'],
             ['LL',                                 '2010年2月14日'],
-            ['LLL',                                '2010年2月14日下午3點25分'],
-            ['LLLL',                               '2010年2月14日星期日下午3點25分'],
+            ['LLL',                                '2010年2月14日 15:25'],
+            ['LLLL',                               '2010年2月14日星期日 15:25'],
             ['l',                                  '2010年2月14日'],
             ['ll',                                 '2010年2月14日'],
-            ['lll',                                '2010年2月14日下午3點25分'],
-            ['llll',                               '2010年2月14日星期日下午3點25分']
+            ['lll',                                '2010年2月14日 15:25'],
+            ['llll',                               '2010年2月14日星期日 15:25']
         ],
         b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
         i;
@@ -119,12 +119,12 @@ test('fromNow', function (assert) {
 test('calendar day', function (assert) {
     var a = moment().hours(12).minutes(0).seconds(0);
 
-    assert.equal(moment(a).calendar(),                   '今天中午12點00分',     'today at the same time');
-    assert.equal(moment(a).add({m: 25}).calendar(),      '今天中午12點25分',     'Now plus 25 min');
-    assert.equal(moment(a).add({h: 1}).calendar(),       '今天下午1點00分',     'Now plus 1 hour');
-    assert.equal(moment(a).add({d: 1}).calendar(),       '明天中午12點00分',     'tomorrow at the same time');
-    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今天上午11點00分',     'Now minus 1 hour');
-    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨天中午12點00分',     'yesterday at the same time');
+    assert.equal(moment(a).calendar(),                   '今天12:00', 'today at the same time');
+    assert.equal(moment(a).add({m: 25}).calendar(),      '今天12:25', 'Now plus 25 min');
+    assert.equal(moment(a).add({h: 1}).calendar(),       '今天13:00', 'Now plus 1 hour');
+    assert.equal(moment(a).add({d: 1}).calendar(),       '明天12:00', 'tomorrow at the same time');
+    assert.equal(moment(a).subtract({h: 1}).calendar(),  '今天11:00', 'Now minus 1 hour');
+    assert.equal(moment(a).subtract({d: 1}).calendar(),  '昨天12:00', 'yesterday at the same time');
 });
 
 test('calendar next week', function (assert) {