return this.lang().weekdays(this, format);
},
w : function () {
- var a = new Date(this.year(), this.month(), this.date());
- a.setHours(0, 0, 0);
- a.setDate(a.getDate() + 4 - (a.getDay() || 7));
- return Math.ceil((1 + (a - (new Date(a.getFullYear(), 0, 1))) / 864e5) / 7);
+ return this.week();
},
W : function () {
return this.isoWeek();
['D Do DD', '14 14-ти 14'],
['d do dddd ddd dd', '0 0-ев неделя нед нд'],
['DDD DDDo DDDD', '45 45-ти 045'],
- ['w wo ww', '6 6-ти 06'],
+ ['w wo ww', '8 8-ми 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. neděle ne ne'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('cs');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "dnes v 2:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "dnes v 2:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "dnes v 3:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('cs');
-
+
for (var i = 2; i < 7; i++) {
var m = moment().add({ d: i });
var nextDay = '';
"calendar last week" : function(test) {
test.expect(15);
moment.lang('cs');
-
+
for (var i = 2; i < 7; i++) {
var m = moment().subtract({ d: i });
var lastDay = '';
moment.lang('cs');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14-мĕш 14'],
['d do dddd ddd dd', '0 0-мĕш вырсарникун выр вр'],
['DDD DDDo DDDD', '45 45-мĕш 045'],
- ['w wo ww', '6 6-мĕш 06'],
+ ['w wo ww', '8 8-мĕш 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8-мĕш', '8-мĕш');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9-мĕш', '9-мĕш');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10-мĕш', '10-мĕш');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11-мĕш', '11-мĕш');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12-мĕш', '12-мĕш');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13-мĕш', '13-мĕш');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18-мĕш', '18-мĕш');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19-мĕш', '19-мĕш');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20-мĕш', '20-мĕш');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21-мĕш', '21-мĕш');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22-мĕш', '22-мĕш');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23-мĕш', '23-мĕш');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28-мĕш', '28-мĕш');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29-мĕш', '29-мĕш');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30-мĕш', '30-мĕш');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31-мĕш', '31-мĕш');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
- moment.lang('cv');
- var a = moment().hours(2).minutes(0).seconds(0);
+ moment.lang('cv');
+ var a = moment().hours(2).minutes(0).seconds(0);
test.equal(moment(a).calendar(), "Паян 02:00 сехетре", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Паян 02:25 сехетре", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Паян 03:00 сехетре", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('cv');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('[Çитес] dddd LT [сехетре]'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('cv');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[Иртнĕ] dddd LT [сехетре]'), "Today - " + i + " days current time");
moment.lang('cv');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. Søndag Søn Sø'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. Sonntag So. So'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('de');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Heute um 2:00 Uhr", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Heute um 2:25 Uhr", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Heute um 3:00 Uhr", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('de');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [um] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('de');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[letzten] dddd [um] LT'), "Today + " + i + " days current time");
moment.lang('de');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14th 14'],
['d do dddd ddd dd', '0 0th Sunday Sun Su'],
['DDD DDDo DDDD', '45 45th 045'],
- ['w wo ww', '6 6th 06'],
+ ['w wo ww', '8 8th 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('en-gb');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Today at 2:00 AM", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Today at 2:25 AM", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Today at 3:00 AM", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('en-gb');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('en-gb');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days current time");
moment.lang('en-gb');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14th 14'],
['d do dddd ddd dd', '0 0th Sunday Sun Su'],
['DDD DDDo DDDD', '45 45th 045'],
- ['w wo ww', '6 6th 06'],
+ ['w wo ww', '8 8th 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8th', '8th');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9th', '9th');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10th', '10th');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11th', '11th');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12th', '12th');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13th', '13th');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18th', '18th');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19th', '19th');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20th', '20th');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21st', '21st');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22nd', '22nd');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23rd', '23rd');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28th', '28th');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29th', '29th');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30th', '30th');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31st', '31st');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('en-gb');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Today at 2:00 AM", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Today at 2:25 AM", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Today at 3:00 AM", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('en-gb');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('en-gb');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days current time");
moment.lang('en-gb');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14th 14'],
['d do dddd ddd dd', '0 0th Sunday Sun Su'],
['DDD DDDo DDDD', '45 45th 045'],
- ['w wo ww', '6 6th 06'],
+ ['w wo ww', '8 8th 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).week(), 2, "Jan 8 2011 should be week 2");
test.equal(moment([2011, 0, 9]).week(), 3, "Jan 9 2011 should be week 3");
+ test.done();
+ },
+
+ "weeks year starting sunday format" : function(test) {
+ test.expect(5);
+
+ test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', "Jan 1 2012 should be week 1");
+ test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', "Jan 7 2012 should be week 1");
+ test.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2nd', "Jan 8 2012 should be week 2");
+ test.equal(moment([2012, 0, 14]).format('w ww wo'), '2 02 2nd', "Jan 14 2012 should be week 2");
+ test.equal(moment([2012, 0, 15]).format('w ww wo'), '3 03 3rd', "Jan 15 2012 should be week 3");
+
test.done();
}
};
['D Do DD', '14 14a 14'],
['d do dddd ddd dd', '0 0a Dimanĉo Dim Di'],
['DDD DDDo DDDD', '45 45a 045'],
- ['w wo ww', '6 6a 06'],
+ ['w wo ww', '8 8a 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8a', '8a');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9a', '9a');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10a', '10a');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11a', '11a');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12a', '12a');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13a', '13a');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18a', '18a');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19a', '19a');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20a', '20a');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23a', '23a');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28a', '28a');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29a', '29a');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30a', '30a');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('eo');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Hodiaŭ je 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Hodiaŭ je 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Hodiaŭ je 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('eo');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [je] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('eo');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[pasinta] dddd [je] LT'), "Today - " + i + " days current time");
moment.lang('eo');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14º 14'],
['d do dddd ddd dd', '0 0º domingo dom. Do'],
['DDD DDDo DDDD', '45 45º 045'],
- ['w wo ww', '6 6º 06'],
+ ['w wo ww', '8 8º 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
test.done();
},
"calendar day" : function(test) {
test.expect(7);
moment.lang('es');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "hoy a las 2:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "hoy a las 2:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "hoy a las 3:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('es');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('es');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), "Today - " + i + " days current time");
moment.lang('es');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. pühapäev P P'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('et');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Täna, 2:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Täna, 2:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Täna, 3:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('et');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('[Järgmine] dddd LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('et');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[Eelmine] dddd LT'), "Today - " + i + " days current time");
moment.lang('en');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 nädal tagasi");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "1 nädala pärast");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 nädalat tagasi");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "2 nädala pärast");
test.done();
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. igandea ig. ig'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('eu');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "gaur 02:00etan", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "gaur 02:25etan", "now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "gaur 03:00etan", "now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('eu');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd LT[etan]'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('eu');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), "Today - " + i + " days current time");
moment.lang('eu');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. sunnuntai su su'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14ème 14'],
['d do dddd ddd dd', '0 0ème dimanche dim. Di'],
['DDD DDDo DDDD', '45 45ème 045'],
- ['w wo ww', '6 6ème 06'],
+ ['w wo ww', '8 8ème 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8ème', '8ème');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9ème', '9ème');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10ème', '10ème');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11ème', '11ème');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12ème', '12ème');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13ème', '13ème');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18ème', '18ème');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19ème', '19ème');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20ème', '20ème');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21ème', '21ème');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22ème', '22ème');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23ème', '23ème');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28ème', '28ème');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29ème', '29ème');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30ème', '30ème');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31ème', '31ème');
test.done();
},
"same day" : function(test) {
test.expect(6);
moment.lang('fr');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Aujourd'hui à 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Aujourd'hui à 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Aujourd'hui à 03:00", "Now plus 1 hour");
"same next week" : function(test) {
test.expect(15);
moment.lang('fr');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [à] LT'), "Today + " + i + " days current time");
"same last week" : function(test) {
test.expect(15);
moment.lang('fr');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('dddd [dernier à] LT'), "Today - " + i + " days current time");
moment.lang('fr');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14ème 14'],
['d do dddd ddd dd', '0 0ème dimanche dim. Di'],
['DDD DDDo DDDD', '45 45ème 045'],
- ['w wo ww', '6 6ème 06'],
+ ['w wo ww', '8 8ème 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8ème', '8ème');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9ème', '9ème');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10ème', '10ème');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11ème', '11ème');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12ème', '12ème');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13ème', '13ème');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18ème', '18ème');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19ème', '19ème');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20ème', '20ème');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21ème', '21ème');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22ème', '22ème');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23ème', '23ème');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28ème', '28ème');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29ème', '29ème');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30ème', '30ème');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31ème', '31ème');
test.done();
},
"same day" : function(test) {
test.expect(6);
moment.lang('fr');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Aujourd'hui à 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Aujourd'hui à 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Aujourd'hui à 03:00", "Now plus 1 hour");
"same next week" : function(test) {
test.expect(15);
moment.lang('fr');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [à] LT'), "Today + " + i + " days current time");
"same last week" : function(test) {
test.expect(15);
moment.lang('fr');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('dddd [dernier à] LT'), "Today - " + i + " days current time");
moment.lang('fr');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 ראשון א׳ א'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14. 14'],
['d do dddd ddd', '0 0. vasárnap v'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['H HH', '15 15'],
['m mm', '25 25'],
['s ss', '50 50'],
var i;
var m;
var days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_');
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('['+days[m.day()]+'] LT[-kor]'), "today + " + i + " days current time");
m.hours(23).minutes(59).seconds(59).milliseconds(999);
test.equal(m.calendar(), m.format('múlt ['+days[m.day()]+'] LT[-kor]'), "today - " + i + " days end of day");
}
-
+
test.done();
},
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 Minggu Min Mg'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
"calendar day" : function(test) {
test.expect(6);
moment.lang('id');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Hari ini pukul 02.00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Hari ini pukul 02.25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Hari ini pukul 03.00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('id');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [pukul] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('id');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('dddd [lalu pukul] LT'), "Today - " + i + " days current time");
moment.lang('id');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. sunnudagur sun Su'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('is');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "í dag kl. 2:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "í dag kl. 2:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "í dag kl. 3:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('is');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [kl.] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('is');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), "Today - " + i + " days current time");
moment.lang('is');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14º 14'],
['d do dddd ddd dd', '0 0º Domenica Dom D'],
['DDD DDDo DDDD', '45 45º 045'],
- ['w wo ww', '6 6º 06'],
+ ['w wo ww', '8 8º 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('it');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Oggi alle 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Oggi alle 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Oggi alle 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('it');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [alle] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('it');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[lo scorso] dddd [alle] LT'), "Today - " + i + " days current time");
moment.lang('it');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 日曜日 日 日'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 日曜日 日 日'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14일 14'],
['d do dddd ddd dd', '0 0일 일요일 일 일'],
['DDD DDDo DDDD', '45 45일 045'],
- ['w wo ww', '6 6일 06'],
+ ['w wo ww', '8 8일 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8일', '8일');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9일', '9일');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10일', '10일');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11일', '11일');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12일', '12일');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13일', '13일');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18일', '18일');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19일', '19일');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20일', '20일');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21일', '21일');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22일', '22일');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23일', '23일');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28일', '28일');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29일', '29일');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30일', '30일');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31일', '31일');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('ko');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "오늘 오전 2시 00분", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "오늘 오전 2시 25분", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "오늘 오전 3시 00분", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('ko');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('ko');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('지난주 dddd LT'), "Today - " + i + " days current time");
moment.lang('ko');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14일 14'],
['d do dddd ddd dd', '0 0일 일요일 일 일'],
['DDD DDDo DDDD', '45 45일 045'],
- ['w wo ww', '6 6일 06'],
+ ['w wo ww', '8 8일 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8일', '8일');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9일', '9일');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10일', '10일');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11일', '11일');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12일', '12일');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13일', '13일');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18일', '18일');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19일', '19일');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20일', '20일');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21일', '21일');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22일', '22일');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23일', '23일');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28일', '28일');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29일', '29일');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30일', '30일');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31일', '31일');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('kr');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "오늘 오전 2시 00분", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "오늘 오전 2시 25분", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "오늘 오전 3시 00분", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('kr');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('kr');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('지난주 dddd LT'), "Today - " + i + " days current time");
moment.lang('kr');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. svētdiena Sv Sv'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. søndag søn sø'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('nb');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "I dag klokken 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "I dag klokken 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "I dag klokken 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('nb');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [klokken] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('nb');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[Forrige] dddd [klokken] LT'), "Today - " + i + " days current time");
moment.lang('nb');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '१४ १४ १४'],
['d do dddd ddd dd', '० ० आइतबार आइत. आइ.'],
['DDD DDDo DDDD', '४५ ४५ ०४५'],
- ['w wo ww', '६ ६ ०६'],
+ ['w wo ww', '८ ८ ०८'],
['h hh', '३ ०३'],
['H HH', '१५ १५'],
['m mm', '२५ २५'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '८', '८');
test.equal(moment([2011, 0, 9]).format('DDDo'), '९', '९');
test.equal(moment([2011, 0, 10]).format('DDDo'), '१०', '१०');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '११', '११');
test.equal(moment([2011, 0, 12]).format('DDDo'), '१२', '१२');
test.equal(moment([2011, 0, 13]).format('DDDo'), '१३', '१३');
test.equal(moment([2011, 0, 18]).format('DDDo'), '१८', '१८');
test.equal(moment([2011, 0, 19]).format('DDDo'), '१९', '१९');
test.equal(moment([2011, 0, 20]).format('DDDo'), '२०', '२०');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '२१', '२१');
test.equal(moment([2011, 0, 22]).format('DDDo'), '२२','२२');
test.equal(moment([2011, 0, 23]).format('DDDo'), '२३', '२३');
test.equal(moment([2011, 0, 28]).format('DDDo'), '२८','२८');
test.equal(moment([2011, 0, 29]).format('DDDo'), '२९','२९');
test.equal(moment([2011, 0, 30]).format('DDDo'), '३०', '३०');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '३१', '३१');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('ne');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "आज रातीको २:०० बजे", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "आज रातीको २:२५ बजे", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "आज बिहानको ३:०० बजे", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('ne');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('[आउँदो] dddd[,] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('ne');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[गएको] dddd[,] LT'), "Today - " + i + " days current time");
moment.lang('ne');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14de 14'],
['d do dddd ddd dd', '0 0de zondag zo. Zo'],
['DDD DDDo DDDD', '45 45ste 045'],
- ['w wo ww', '6 6de 06'],
+ ['w wo ww', '8 8ste 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8ste', '8ste');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9de', '9de');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10de', '10de');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11de', '11de');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12de', '12de');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13de', '13de');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18de', '18de');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19de', '19de');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20ste', '20ste');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21ste', '21ste');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22ste', '22ste');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23ste', '23ste');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28ste', '28ste');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29ste', '29ste');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30ste', '30ste');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31ste', '31ste');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('nl');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Vandaag om 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Vandaag om 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Vandaag om 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('nl');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [om] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('nl');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), "Today - " + i + " days current time");
moment.lang('nl');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
"month abbreviation" : function(test) {
test.expect(2);
moment.lang('nl');
-
+
test.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot');
test.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot');
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. niedziela nie N'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8.');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9.');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10.');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11.');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12.');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13.');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18.');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19.');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20.');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21.');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22.');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23.');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28.');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29.');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30.');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31.');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('pl');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Dziś o 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Dziś o 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Dziś o 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('pl');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('[W] dddd [o] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('pl');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[W zeszły/łą] dddd [o] LT'), "Today - " + i + " days current time");
moment.lang('pl');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14º 14'],
['d do dddd ddd', '0 0º Domingo Dom'],
['DDD DDDo DDDD', '45 45º 045'],
- ['w wo ww', '6 6º 06'],
+ ['w wo ww', '8 8º 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('pt-br');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Hoje às 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Hoje às 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Hoje às 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('pt-br');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [às] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('pt-br');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), "Today - " + i + " days current time");
moment.lang('pt-br');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14º 14'],
['d do dddd ddd dd', '0 0º Domingo Dom Dom'],
['DDD DDDo DDDD', '45 45º 045'],
- ['w wo ww', '6 6º 06'],
+ ['w wo ww', '8 8º 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8º', '8º');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9º', '9º');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10º', '10º');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11º', '11º');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12º', '12º');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13º', '13º');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18º', '18º');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19º', '19º');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20º', '20º');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21º', '21º');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22º', '22º');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23º', '23º');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28º', '28º');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29º', '29º');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30º', '30º');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31º', '31º');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('pt');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Hoje às 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Hoje às 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Hoje às 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('pt');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [às] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('pt');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), "Today - " + i + " days current time");
moment.lang('pt');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 Duminică Dum Du'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. воскресенье вск вс'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14. 14'],
['d do dddd ddd dd', '0 0. nedelja ned. ne'],
['DDD DDDo DDDD', '45 45. 045'],
- ['w wo ww', '6 6. 06'],
+ ['w wo ww', '8 8. 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14e 14'],
['d do dddd ddd dd', '0 0e söndag sön sö'],
['DDD DDDo DDDD', '45 45e 045'],
- ['w wo ww', '6 6e 06'],
+ ['w wo ww', '8 8e 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8e', '8e');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9e', '9e');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10e', '10e');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11e', '11e');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12e', '12e');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13e', '13e');
test.equal(moment([2011, 0, 18]).format('DDDo'), '18e', '18e');
test.equal(moment([2011, 0, 19]).format('DDDo'), '19e', '19e');
test.equal(moment([2011, 0, 20]).format('DDDo'), '20e', '20e');
-
+
test.equal(moment([2011, 0, 21]).format('DDDo'), '21a', '21a');
test.equal(moment([2011, 0, 22]).format('DDDo'), '22a', '22a');
test.equal(moment([2011, 0, 23]).format('DDDo'), '23e', '23e');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28e', '28e');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29e', '29e');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30e', '30e');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31a', '31a');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('sv');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "Idag klockan 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "Idag klockan 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "Idag klockan 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('sv');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('dddd [klockan] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('sv');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[Förra] dddd[en klockan] LT'), "Today - " + i + " days current time");
moment.lang('sv');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14\'üncü 14'],
['d do dddd ddd dd', '0 0\'ıncı Pazar Paz Pz'],
['DDD DDDo DDDD', '45 45\'inci 045'],
- ['w wo ww', '6 6\'ncı 06'],
+ ['w wo ww', '8 8\'inci 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
test.equal(moment([2011, 0, 8]).format('DDDo'), '8\'inci', '8th');
test.equal(moment([2011, 0, 9]).format('DDDo'), '9\'uncu', '9th');
test.equal(moment([2011, 0, 10]).format('DDDo'), '10\'uncu', '10th');
-
+
test.equal(moment([2011, 0, 11]).format('DDDo'), '11\'inci', '11th');
test.equal(moment([2011, 0, 12]).format('DDDo'), '12\'nci', '12th');
test.equal(moment([2011, 0, 13]).format('DDDo'), '13\'üncü', '13th');
test.equal(moment([2011, 0, 28]).format('DDDo'), '28\'inci', '28th');
test.equal(moment([2011, 0, 29]).format('DDDo'), '29\'uncu', '29th');
test.equal(moment([2011, 0, 30]).format('DDDo'), '30\'uncu', '30th');
-
+
test.equal(moment([2011, 0, 31]).format('DDDo'), '31\'inci', '31st');
test.done();
},
"calendar day" : function(test) {
test.expect(6);
moment.lang('tr');
-
+
var a = moment().hours(2).minutes(0).seconds(0);
-
+
test.equal(moment(a).calendar(), "bugün saat 02:00", "today at the same time");
test.equal(moment(a).add({ m: 25 }).calendar(), "bugün saat 02:25", "Now plus 25 min");
test.equal(moment(a).add({ h: 1 }).calendar(), "bugün saat 03:00", "Now plus 1 hour");
"calendar next week" : function(test) {
test.expect(15);
moment.lang('tr');
-
+
var i;
var m;
-
+
for (i = 2; i < 7; i++) {
m = moment().add({ d: i });
test.equal(m.calendar(), m.format('[haftaya] dddd [saat] LT'), "Today + " + i + " days current time");
"calendar last week" : function(test) {
test.expect(15);
moment.lang('tr');
-
+
for (i = 2; i < 7; i++) {
m = moment().subtract({ d: i });
test.equal(m.calendar(), m.format('[geçen hafta] dddd [saat] LT'), "Today - " + i + " days current time");
moment.lang('tr');
var weeksAgo = moment().subtract({ w: 1 });
var weeksFromNow = moment().add({ w: 1 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "1 week ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 1 week");
-
+
weeksAgo = moment().subtract({ w: 2 });
weeksFromNow = moment().add({ w: 2 });
-
+
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 weeks ago");
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "in 2 weeks");
test.done();
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 星期日 周日 日'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
['D Do DD', '14 14 14'],
['d do dddd ddd dd', '0 0 星期日 週日 日'],
['DDD DDDo DDDD', '45 45 045'],
- ['w wo ww', '6 6 06'],
+ ['w wo ww', '8 8 08'],
['h hh', '3 03'],
['H HH', '15 15'],
['m mm', '25 25'],
for (var i in cases) {
var iso = cases[i].split('-').pop();
- var the = moment(i).format('ww');
+ var the = moment(i).format('WW');
test.equal(iso, the, i + ": should be " + iso + ", but " + the);
}