From: Jason Katz-Brown Date: Tue, 15 Nov 2016 08:15:19 +0000 (-0700) Subject: Standardize CJK time formats. X-Git-Tag: 2.18.0~46^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f38d69c3675914442c541c876e116370a731fd40;p=thirdparty%2Fmoment.git Standardize CJK time formats. 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. --- diff --git a/src/locale/ja.js b/src/locale/ja.js index 38a262ed3..6b2180489 100644 --- a/src/locale/ja.js +++ b/src/locale/ja.js @@ -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) { diff --git a/src/locale/ko.js b/src/locale/ko.js index 8df73a453..e84799307 100644 --- a/src/locale/ko.js +++ b/src/locale/ko.js @@ -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', diff --git a/src/locale/zh-cn.js b/src/locale/zh-cn.js index 031c50e66..ad7ac8850 100644 --- a/src/locale/zh-cn.js +++ b/src/locale/zh-cn.js @@ -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) { diff --git a/src/locale/zh-hk.js b/src/locale/zh-hk.js index 51d385d89..f8bf2d1da 100644 --- a/src/locale/zh-hk.js +++ b/src/locale/zh-hk.js @@ -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) { diff --git a/src/locale/zh-tw.js b/src/locale/zh-tw.js index 577d61eb5..fba8a8015 100644 --- a/src/locale/zh-tw.js +++ b/src/locale/zh-tw.js @@ -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) { diff --git a/src/test/locale/ja.js b/src/test/locale/ja.js index 76f1b6885..2435e13a1 100644 --- a/src/test/locale/ja.js +++ b/src/test/locale/ja.js @@ -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) { diff --git a/src/test/locale/ko.js b/src/test/locale/ko.js index 443e51d52..0b71d5bae 100644 --- a/src/test/locale/ko.js +++ b/src/test/locale/ko.js @@ -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) { diff --git a/src/test/locale/zh-cn.js b/src/test/locale/zh-cn.js index 86a66219d..5951dc877 100644 --- a/src/test/locale/zh-cn.js +++ b/src/test/locale/zh-cn.js @@ -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) { diff --git a/src/test/locale/zh-hk.js b/src/test/locale/zh-hk.js index 20c90fa74..903d932c9 100644 --- a/src/test/locale/zh-hk.js +++ b/src/test/locale/zh-hk.js @@ -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) { diff --git a/src/test/locale/zh-tw.js b/src/test/locale/zh-tw.js index 82c65e14a..4cd415c3d 100644 --- a/src/test/locale/zh-tw.js +++ b/src/test/locale/zh-tw.js @@ -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) {