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) {
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',
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) {
}
},
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) {
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) {
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) {
['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;
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) {
['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;
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) {
['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;
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) {
['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;
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) {
['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;
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) {