mirror of
https://github.com/bodyrep/DemoApp.git
synced 2026-03-19 11:25:51 +00:00
can read and display workouts
This commit is contained in:
265
node_modules/moment/test/lang/bg.js
generated
vendored
Normal file
265
node_modules/moment/test/lang/bg.js
generated
vendored
Normal file
@@ -0,0 +1,265 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Bulgarian
|
||||
*************************************************/
|
||||
|
||||
exports["lang:bg"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('bg');
|
||||
var tests = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('bg');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'неделя, февруари 14. 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'нед, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 февруари фев'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14. 14'],
|
||||
['d do dddd ddd dd', '0 0. неделя нед нд'],
|
||||
['DDD DDDo DDDD', '45 45. 045'],
|
||||
['w wo ww', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '14.02.2010'],
|
||||
['LL', '14 февруари 2010'],
|
||||
['LLL', '14 февруари 2010 3:25'],
|
||||
['LLLL', 'неделя, 14 февруари 2010 3:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('bg');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('bg');
|
||||
var expected = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('bg');
|
||||
var expected = 'неделя нед нд_понеделник пон пн_вторник вто вт_сряда сря ср_четвъртък чет чт_петък пет пт_събота съб сб'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('bg');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "няколко секунди", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "минута", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "минута", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 минути", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 минути", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "час", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "час", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 часа", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 часа", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 часа", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "ден", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "ден", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 дни", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "ден", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 дни", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 дни", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "месец", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "месец", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "месец", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 месеца", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 месеца", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 месеца", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "месец", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 месеца", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 месеца", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "година", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "година", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 години", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "година", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 години", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('bg');
|
||||
test.equal(moment(30000).from(0), "след няколко секунди", "prefix");
|
||||
test.equal(moment(0).from(30000), "преди няколко секунди", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('bg');
|
||||
test.equal(moment().fromNow(), "преди няколко секунди", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('bg');
|
||||
test.equal(moment().add({s:30}).fromNow(), "след няколко секунди", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "след 5 дни", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('bg');
|
||||
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Утре в 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Днес в 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Вчера в 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('bg');
|
||||
|
||||
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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [в] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [в] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('bg');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
function makeFormat(d) {
|
||||
switch (d.day()) {
|
||||
case 0:
|
||||
case 3:
|
||||
case 6:
|
||||
return '[В изминалата] dddd [в] LT';
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
case 5:
|
||||
return '[В изминалия] dddd [в] LT';
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('bg');
|
||||
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();
|
||||
}
|
||||
};
|
||||
221
node_modules/moment/test/lang/ca.js
generated
vendored
Normal file
221
node_modules/moment/test/lang/ca.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Català
|
||||
*************************************************/
|
||||
|
||||
exports["lang:ca"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('ca');
|
||||
|
||||
var tests = "Gener Gen._Febrer Febr._Març Mar._Abril Abr._Maig Mai._Juny Jun._Juliol Jul._Agost Ag._Setembre Set._Octubre Oct._Novembre Nov._Desembre Des.".split("_");
|
||||
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('ca');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º');
|
||||
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, 14]).format('DDDo'), '14º', '14º');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
|
||||
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, 24]).format('DDDo'), '24º', '24º');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('ca');
|
||||
var expected = "Gener Gen._Febrer Febr._Març Mar._Abril Abr._Maig Mai._Juny Jun._Juliol Jul._Agost Ag._Setembre Set._Octubre Oct._Novembre Nov._Desembre Des.".split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('ca');
|
||||
var expected = "Diumenge Dg. Dg_Dilluns Dl. Dl_Dimarts Dt. Dt_Dimecres Dc. Dc_Dijous Dj. Dj_Divendres Dv. Dv_Dissabte Ds. Ds".split("_");
|
||||
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('ca');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "uns segons", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minut", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minut", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuts", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuts", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "una hora", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "una hora", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 hores", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 hores", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 hores", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un dia", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un dia", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dies", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un dia", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dies", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dies", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mes", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mes", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mes", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mesos", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mesos", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mesos", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mes", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mesos", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mesos", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un any", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un any", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anys", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un any", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anys", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ca');
|
||||
test.equal(moment(30000).from(0), "en uns segons", "prefix");
|
||||
test.equal(moment(0).from(30000), "fa uns segons", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('ca');
|
||||
test.equal(moment().fromNow(), "fa uns segons", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ca');
|
||||
test.equal(moment().add({s:30}).fromNow(), "en uns segons", "en uns segons");
|
||||
test.equal(moment().add({d:5}).fromNow(), "en 5 dies", "en 5 dies");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('ca');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "avui a les 2:00", "today at the same time");
|
||||
test.equal(moment(a).add({ m: 25 }).calendar(), "avui a les 2:25", "Now plus 25 min");
|
||||
test.equal(moment(a).add({ h: 1 }).calendar(), "avui a les 3:00", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "demà a les 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).add({ d: 1, h : -1 }).calendar(), "demà a la 1:00", "tomorrow minus 1 hour");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "avui a la 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "ahir a les 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ca');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), "Today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ca');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[el] dddd [passat a ' + ((m.hours() !== 1) ? 'les' : 'la') + '] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('ca');
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/cv.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/cv.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Chuvash
|
||||
*************************************************/
|
||||
|
||||
exports["lang:cv"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('cv');
|
||||
var tests = 'кăрлач кăр_нарăс нар_пуш пуш_ака ака_май май_çĕртме çĕр_утă утă_çурла çур_авăн ав_юпа юпа_чӳк чӳк_раштав раш'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('cv');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'вырсарникун, нарăс 14-мĕш 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'выр, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2-мĕш 02 нарăс нар'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14-мĕш 14'],
|
||||
['d do dddd ddd dd', '0 0-мĕш вырсарникун выр вр'],
|
||||
['DDD DDDo DDDD', '45 45-мĕш 045'],
|
||||
['w wo ww', '8 8-мĕш 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['Çулăн DDDo кунĕ', 'Çулăн 45-мĕш кунĕ'],
|
||||
['L', '14-02-2010'],
|
||||
['LL', '2010 çулхи нарăс уйăхĕн 14-мĕшĕ'],
|
||||
['LLL', '2010 çулхи нарăс уйăхĕн 14-мĕшĕ, 15:25'],
|
||||
['LLLL', 'вырсарникун, 2010 çулхи нарăс уйăхĕн 14-мĕшĕ, 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('cv');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1-мĕш', '1-мĕш');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2-мĕш', '2-мĕш');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3-мĕш', '3-мĕш');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4-мĕш', '4-мĕш');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5-мĕш', '5-мĕш');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6-мĕш', '6-мĕш');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7-мĕш', '7-мĕш');
|
||||
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, 14]).format('DDDo'), '14-мĕш', '14-мĕш');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15-мĕш', '15-мĕш');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16-мĕш', '16-мĕш');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17-мĕш', '17-мĕш');
|
||||
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, 24]).format('DDDo'), '24-мĕш', '24-мĕш');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25-мĕш', '25-мĕш');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26-мĕш', '26-мĕш');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27-мĕш', '27-мĕш');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('cv');
|
||||
var expected = 'кăрлач кăр_нарăс нар_пуш пуш_ака ака_май май_çĕртме çĕр_утă утă_çурла çур_авăн ав_юпа юпа_чӳк чӳк_раштав раш'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('cv');
|
||||
var expected = 'вырсарникун выр вр_тунтикун тун тн_ытларикун ытл ыт_юнкун юн юн_кĕçнерникун кĕç кç_эрнекун эрн эр_шăматкун шăм шм'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('cv');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "пĕр-ик çеккунт", "44 sekunder = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "пĕр минут", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "пĕр минут", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 минут", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 минут", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "пĕр сехет", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "пĕр сехет", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 сехет", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 сехет", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 сехет", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "пĕр кун", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "пĕр кун", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 кун", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "пĕр кун", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 кун", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 кун", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "пĕр уйăх", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "пĕр уйăх", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "пĕр уйăх", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 уйăх", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 уйăх", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 уйăх", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "пĕр уйăх", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 уйăх", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 уйăх", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "пĕр çул", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "пĕр çул", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 çул", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "пĕр çул", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 çул", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('cv');
|
||||
test.equal(moment(30000).from(0), "пĕр-ик çеккунтран", "prefix");
|
||||
test.equal(moment(0).from(30000), "пĕр-ик çеккунт каялла", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('cv');
|
||||
test.equal(moment().fromNow(), "пĕр-ик çеккунт каялла", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('cv');
|
||||
test.equal(moment().add({s:30}).fromNow(), "пĕр-ик çеккунтран", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5 кунран", "in 5 days");
|
||||
test.equal(moment().add({h:2}).fromNow(), "2 сехетрен", "in 2 hours, the right suffix!");
|
||||
test.equal(moment().add({y:3}).fromNow(), "3 çултан", "in 3 years, the right suffix!");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Ыран 02:00 сехетре", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Паян 01:00 сехетре", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Ĕнер 02:00 сехетре", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[Çитес] dddd LT [сехетре]'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[Çитес] dddd LT [сехетре]'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[Иртнĕ] dddd LT [сехетре]'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[Иртнĕ] dddd LT [сехетре]'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
183
node_modules/moment/test/lang/da.js
generated
vendored
Normal file
183
node_modules/moment/test/lang/da.js
generated
vendored
Normal file
@@ -0,0 +1,183 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Danish
|
||||
*************************************************/
|
||||
|
||||
exports["lang:da"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('da');
|
||||
var tests = 'Januar Jan_Februar Feb_Marts Mar_April Apr_Maj Maj_Juni Jun_Juli Jul_August Aug_September Sep_Oktober Okt_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('da');
|
||||
var a = [
|
||||
['dddd \\den MMMM Do YYYY, h:mm:ss a', 'Søndag den Februar 14. 2010, 3:25:50 pm'],
|
||||
['ddd hA', 'Søn 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 Februar Feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['[den] DDDo \\d\\ag på året', 'den 45. dag på året'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 Februar 2010'],
|
||||
['LLL', '14 Februar 2010 3:25 PM'],
|
||||
['LLLL', 'Søndag 14. Februar, 2010 3:25 PM']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('da');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('da');
|
||||
var expected = 'Januar Jan_Februar Feb_Marts Mar_April Apr_Maj Maj_Juni Jun_Juli Jul_August Aug_September Sep_Oktober Okt_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('da');
|
||||
var expected = 'Søndag Søn Sø_Mandag Man Ma_Tirsdag Tir Ti_Onsdag Ons On_Torsdag Tor To_Fredag Fre Fr_Lørdag Lør Lø'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('da');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "få sekunder", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "minut", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "minut", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutter", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutter", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "time", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "time", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 timer", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 timer", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 timer", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "dag", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "dag", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dage", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "dag", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dage", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dage", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "månede", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "månede", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "månede", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 måneder", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 måneder", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 måneder", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "månede", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 måneder", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 måneder", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "år", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "år", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 år", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "år", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 år", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('da');
|
||||
test.equal(moment(30000).from(0), "om få sekunder", "prefix");
|
||||
test.equal(moment(0).from(30000), "få sekunder siden", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('da');
|
||||
test.equal(moment().fromNow(), "få sekunder siden", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('da');
|
||||
test.equal(moment().add({s:30}).fromNow(), "om få sekunder", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "om 5 dage", "in 5 days");
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
241
node_modules/moment/test/lang/de.js
generated
vendored
Normal file
241
node_modules/moment/test/lang/de.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
German
|
||||
*************************************************/
|
||||
|
||||
exports["lang:de"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('de');
|
||||
var tests = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('de');
|
||||
var a = [
|
||||
['dddd, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'So., 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 Februar Febr.'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '14.02.2010'],
|
||||
['LL', '14. Februar 2010'],
|
||||
['LLL', '14. Februar 2010 15:25 Uhr'],
|
||||
['LLLL', 'Sonntag, 14. Februar 2010 15:25 Uhr']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('de');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('de');
|
||||
var expected = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('de');
|
||||
var expected = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. Sa'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('de');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "ein paar Sekunden", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "einer Minute", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "einer Minute", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 Minuten", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 Minuten", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "einer Stunde", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "einer Stunde", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 Stunden", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 Stunden", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 Stunden", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "einem Tag", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "einem Tag", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 Tagen", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "einem Tag", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 Tagen", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 Tagen", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "einem Monat", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "einem Monat", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "einem Monat", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 Monaten", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 Monaten", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 Monaten", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "einem Monat", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 Monaten", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 Monaten", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "einem Jahr", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "einem Jahr", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 Jahren", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "einem Jahr", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 Jahren", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('de');
|
||||
test.equal(moment(30000).from(0), "in ein paar Sekunden", "prefix");
|
||||
test.equal(moment(0).from(30000), "vor ein paar Sekunden", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('de');
|
||||
test.equal(moment().add({s:30}).fromNow(), "in ein paar Sekunden", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "in 5 Tagen", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Morgen um 2:00 Uhr", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Heute um 1:00 Uhr", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Gestern um 2:00 Uhr", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [um] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [um] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[letzten] dddd [um] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[letzten] dddd [um] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/en-ca.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/en-ca.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
English
|
||||
*************************************************/
|
||||
|
||||
exports["lang:en-ca"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('en-ca');
|
||||
var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('en-ca');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Sun, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2nd 02 February Feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8th 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45th day of the year'],
|
||||
['L', '2010-02-14'],
|
||||
['LL', '14 February, 2010'],
|
||||
['LLL', '14 February, 2010 3:25 PM'],
|
||||
['LLLL', 'Sunday, 14 February, 2010 3:25 PM']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th');
|
||||
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, 14]).format('DDDo'), '14th', '14th');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th');
|
||||
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, 24]).format('DDDo'), '24th', '24th');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('en-gb');
|
||||
var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('en-gb');
|
||||
var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('en-gb');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "a few seconds", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "a minute", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "a minute", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "an hour", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "an hour", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 hours", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 hours", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 hours", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "a day", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "a day", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 days", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "a day", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 days", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 days", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "a month", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "a month", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "a month", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 months", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 months", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 months", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "a month", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 months", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 months", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "a year", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "a year", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 years", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "a year", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 years", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment(30000).from(0), "in a few seconds", "prefix");
|
||||
test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment().add({s:30}).fromNow(), "in a few seconds", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "in 5 days", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Tomorrow at 2:00 AM", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Today at 1:00 AM", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Yesterday at 2:00 AM", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/en-gb.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/en-gb.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
English
|
||||
*************************************************/
|
||||
|
||||
exports["lang:en-gb"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('en-gb');
|
||||
var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('en-gb');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Sun, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2nd 02 February Feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8th 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45th day of the year'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 February 2010'],
|
||||
['LLL', '14 February 2010 3:25 PM'],
|
||||
['LLLL', 'Sunday, 14 February 2010 3:25 PM']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th');
|
||||
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, 14]).format('DDDo'), '14th', '14th');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th');
|
||||
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, 24]).format('DDDo'), '24th', '24th');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('en-gb');
|
||||
var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('en-gb');
|
||||
var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('en-gb');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "a few seconds", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "a minute", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "a minute", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "an hour", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "an hour", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 hours", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 hours", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 hours", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "a day", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "a day", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 days", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "a day", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 days", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 days", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "a month", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "a month", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "a month", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 months", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 months", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 months", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "a month", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 months", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 months", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "a year", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "a year", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 years", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "a year", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 years", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment(30000).from(0), "in a few seconds", "prefix");
|
||||
test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('en-gb');
|
||||
test.equal(moment().add({s:30}).fromNow(), "in a few seconds", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "in 5 days", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Tomorrow at 2:00 AM", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Today at 1:00 AM", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Yesterday at 2:00 AM", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/en.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/en.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
English
|
||||
*************************************************/
|
||||
|
||||
exports["lang:en"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('en');
|
||||
var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('en');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Sun, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2nd 02 February Feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8th 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45th day of the year'],
|
||||
['L', '02/14/2010'],
|
||||
['LL', 'February 14 2010'],
|
||||
['LLL', 'February 14 2010 3:25 PM'],
|
||||
['LLLL', 'Sunday, February 14 2010 3:25 PM']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('en');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4th', '4th');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5th', '5th');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6th', '6th');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7th', '7th');
|
||||
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, 14]).format('DDDo'), '14th', '14th');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15th', '15th');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16th', '16th');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17th', '17th');
|
||||
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, 24]).format('DDDo'), '24th', '24th');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25th', '25th');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26th', '26th');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27th', '27th');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('en');
|
||||
var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('en');
|
||||
var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('en');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "a few seconds", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "a minute", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "a minute", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "an hour", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "an hour", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 hours", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 hours", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 hours", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "a day", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "a day", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 days", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "a day", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 days", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 days", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "a month", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "a month", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "a month", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 months", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 months", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 months", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "a month", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 months", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 months", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "a year", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "a year", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 years", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "a year", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 years", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('en');
|
||||
test.equal(moment(30000).from(0), "in a few seconds", "prefix");
|
||||
test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('en');
|
||||
test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('en');
|
||||
test.equal(moment().add({s:30}).fromNow(), "in a few seconds", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "in 5 days", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('en');
|
||||
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Tomorrow at 2:00 AM", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Today at 1:00 AM", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Yesterday at 2:00 AM", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('en');
|
||||
|
||||
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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [at] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('en');
|
||||
|
||||
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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[last] dddd [at] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('en');
|
||||
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();
|
||||
}
|
||||
};
|
||||
218
node_modules/moment/test/lang/es.js
generated
vendored
Normal file
218
node_modules/moment/test/lang/es.js
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Spanish
|
||||
*************************************************/
|
||||
|
||||
exports["lang:es"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('es');
|
||||
var tests = 'Enero Ene._Febrero Feb._Marzo Mar._Abril Abr._Mayo May._Junio Jun._Julio Jul._Agosto Ago._Septiembre Sep._Octubre Oct._Noviembre Nov._Diciembre Dic.'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('es');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º');
|
||||
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, 14]).format('DDDo'), '14º', '14º');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
|
||||
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, 24]).format('DDDo'), '24º', '24º');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('es');
|
||||
var expected = 'Enero Ene._Febrero Feb._Marzo Mar._Abril Abr._Mayo May._Junio Jun._Julio Jul._Agosto Ago._Septiembre Sep._Octubre Oct._Noviembre Nov._Diciembre Dic.'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('es');
|
||||
var expected = 'Domingo Dom. Do_Lunes Lun. Lu_Martes Mar. Ma_Miércoles Mié. Mi_Jueves Jue. Ju_Viernes Vie. Vi_Sábado Sáb. Sá'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('es');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "unos segundos", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minuto", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minuto", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutos", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutos", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "una hora", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "una hora", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 horas", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 horas", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 horas", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un día", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un día", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 días", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un día", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 días", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 días", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mes", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mes", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mes", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 meses", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 meses", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 meses", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mes", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 meses", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 meses", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un año", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un año", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 años", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un año", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 años", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('es');
|
||||
test.equal(moment(30000).from(0), "en unos segundos", "prefix");
|
||||
test.equal(moment(0).from(30000), "hace unos segundos", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('es');
|
||||
test.equal(moment().fromNow(), "hace unos segundos", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('es');
|
||||
test.equal(moment().add({s:30}).fromNow(), "en unos segundos", "en unos segundos");
|
||||
test.equal(moment().add({d:5}).fromNow(), "en 5 días", "en 5 días");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "mañana a las 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).add({ d: 1, h : -1 }).calendar(), "mañana a la 1:00", "tomorrow minus 1 hour");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "hoy a la 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "ayer a las 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[el] dddd [pasado a la' + ((m.hours() !== 1) ? 's' : '') + '] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/et.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/et.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
English
|
||||
*************************************************/
|
||||
|
||||
exports["lang:et"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('et');
|
||||
var tests = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' peaks olema kuu ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('et');
|
||||
var a = [
|
||||
['dddd, Do MMMM YYYY, H:mm:ss', 'pühapäev, 14. veebruar 2010, 15:25:50'],
|
||||
['ddd, h', 'P, 3'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 veebruar veebr'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['\\a\\a\\st\\a DDDo päev', 'aasta 45. päev'],
|
||||
['L', '14.02.2010'],
|
||||
['LL', '14. veebruar 2010'],
|
||||
['LLL', '14. veebruar 2010 15:25'],
|
||||
['LLLL', 'pühapäev, 14. veebruar 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('et');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('et');
|
||||
var expected = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('et');
|
||||
var expected = 'pühapäev P P_esmaspäev E E_teisipäev T T_kolmapäev K K_neljapäev N N_reede R R_laupäev L L'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('et');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "paari sekundi", "44 seconds = paari sekundi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "minut", "45 seconds = minut");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "minut", "89 seconds = minut");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutit", "90 seconds = 2 minutit");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutit", "44 minutes = 44 minutit");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "tund", "45 minutes = tund");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "tund", "89 minutes = tund");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 tundi", "90 minutes = 2 tundi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 tundi", "5 hours = 5 tundi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 tundi", "21 hours = 21 tundi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "päev", "22 hours = päev");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "päev", "35 hours = päev");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 päeva", "36 hours = 2 päeva");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "päev", "1 day = päev");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 päeva", "5 days = 5 päeva");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 päeva", "25 days = 25 päeva");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "kuu", "26 days = kuu");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "kuu", "30 days = kuu");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "kuu", "45 days = kuu");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 kuud", "46 days = 2 kuud");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 kuud", "75 days = 2 kuud");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 kuud", "76 days = 3 kuud");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "kuu", "1 month = kuu");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 kuud", "5 months = 5 kuud");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 kuud", "344 days = 11 kuud");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "aasta", "345 days = aasta");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "aasta", "547 days = aasta");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 aastat", "548 days = 2 aastat");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "aasta", "1 year = aasta");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 aastat", "5 years = 5 aastat");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('et');
|
||||
test.equal(moment(30000).from(0), "paari sekundi pärast", "prefix");
|
||||
test.equal(moment(0).from(30000), "paar sekundit tagasi", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('et');
|
||||
test.equal(moment().fromNow(), "paar sekundit tagasi", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('et');
|
||||
test.equal(moment().add({s:30}).fromNow(), "paari sekundi pärast", "paari sekundi pärast");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5 päeva pärast", "5 päeva pärast");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Homme, 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Täna, 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Eile, 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[Järgmine] dddd LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[Järgmine] dddd LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[Eelmine] dddd LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[Eelmine] dddd LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/eu.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/eu.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Euskara
|
||||
*************************************************/
|
||||
|
||||
exports["lang:eu"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('eu');
|
||||
var tests = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('eu');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'igandea, otsaila 14. 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'ig., 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 otsaila ots.'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '2010-02-14'],
|
||||
['LL', '2010ko otsailaren 14a'],
|
||||
['LLL', '2010ko otsailaren 14a 15:25'],
|
||||
['LLLL', 'igandea, 2010ko otsailaren 14a 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('eu');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('eu');
|
||||
var expected = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('eu');
|
||||
var expected = 'igandea ig. ig_astelehena al. al_asteartea ar. ar_asteazkena az. az_osteguna og. og_ostirala ol. ol_larunbata lr. lr'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('eu');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "segundo batzuk", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "minutu bat", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "minutu bat", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutu", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutu", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "ordu bat", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "ordu bat", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 ordu", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 ordu", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 ordu", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "egun bat", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "egun bat", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 egun", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "egun bat", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 egun", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 egun", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "hilabete bat", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "hilabete bat", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "hilabete bat", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 hilabete", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 hilabete", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 hilabete", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "hilabete bat", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 hilabete", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 hilabete", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "urte bat", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "urte bat", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 urte", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "urte bat", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 urte", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('eu');
|
||||
test.equal(moment(30000).from(0), "segundo batzuk barru", "prefix");
|
||||
test.equal(moment(0).from(30000), "duela segundo batzuk", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('eu');
|
||||
test.equal(moment().fromNow(), "duela segundo batzuk", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('eu');
|
||||
test.equal(moment().add({s:30}).fromNow(), "segundo batzuk barru", "in seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5 egun barru", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "bihar 02:00etan", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "gaur 01:00etan", "now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "atzo 02:00etan", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd LT[etan]'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd LT[etan]'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[aurreko] dddd LT[etan]'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/fi.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/fi.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Finnish
|
||||
*************************************************/
|
||||
|
||||
exports["lang:fi"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('fi');
|
||||
var tests = 'tammikuu tam_helmikuu hel_maaliskuu maa_huhtikuu huh_toukokuu tou_kesäkuu kes_heinäkuu hei_elokuu elo_syyskuu syys_lokakuu lok_marraskuu mar_joulukuu jou'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('fi');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'sunnuntai, helmikuu 14. 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'su, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 helmikuu hel'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['vuo\\den DDDo päivä', 'vuoden 45. päivä'],
|
||||
['L', '14.02.2010'],
|
||||
['LL', '14. helmikuuta 2010'],
|
||||
['LLL', '14. helmikuuta 2010, klo 15.25'],
|
||||
['LLLL', 'sunnuntai, 14. helmikuuta 2010, klo 15.25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('fi');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1st');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2nd');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3rd');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4th');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5th');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6th');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7th');
|
||||
test.equal(moment([2011, 0, 8]).format('DDDo'), '8.', '8th');
|
||||
test.equal(moment([2011, 0, 9]).format('DDDo'), '9.', '9th');
|
||||
test.equal(moment([2011, 0, 10]).format('DDDo'), '10.', '10th');
|
||||
|
||||
test.equal(moment([2011, 0, 11]).format('DDDo'), '11.', '11th');
|
||||
test.equal(moment([2011, 0, 12]).format('DDDo'), '12.', '12th');
|
||||
test.equal(moment([2011, 0, 13]).format('DDDo'), '13.', '13th');
|
||||
test.equal(moment([2011, 0, 14]).format('DDDo'), '14.', '14th');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15th');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16th');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17th');
|
||||
test.equal(moment([2011, 0, 18]).format('DDDo'), '18.', '18th');
|
||||
test.equal(moment([2011, 0, 19]).format('DDDo'), '19.', '19th');
|
||||
test.equal(moment([2011, 0, 20]).format('DDDo'), '20.', '20th');
|
||||
|
||||
test.equal(moment([2011, 0, 21]).format('DDDo'), '21.', '21st');
|
||||
test.equal(moment([2011, 0, 22]).format('DDDo'), '22.', '22nd');
|
||||
test.equal(moment([2011, 0, 23]).format('DDDo'), '23.', '23rd');
|
||||
test.equal(moment([2011, 0, 24]).format('DDDo'), '24.', '24th');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25th');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26th');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27th');
|
||||
test.equal(moment([2011, 0, 28]).format('DDDo'), '28.', '28th');
|
||||
test.equal(moment([2011, 0, 29]).format('DDDo'), '29.', '29th');
|
||||
test.equal(moment([2011, 0, 30]).format('DDDo'), '30.', '30th');
|
||||
|
||||
test.equal(moment([2011, 0, 31]).format('DDDo'), '31.', '31st');
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('fi');
|
||||
var expected = 'tammikuu tam_helmikuu hel_maaliskuu maa_huhtikuu huh_toukokuu tou_kesäkuu kes_heinäkuu hei_elokuu elo_syyskuu syy_lokakuu lok_marraskuu mar_joulukuu jou'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('fi');
|
||||
var expected = 'sunnuntai su su_maanantai ma ma_tiistai ti ti_keskiviikko ke ke_torstai to to_perjantai pe pe_lauantai la la'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('fi');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "muutama sekunti", "44 seconds = few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "minuutti", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "minuutti", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "kaksi minuuttia", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuuttia", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "tunti", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "tunti", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "kaksi tuntia", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "viisi tuntia", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 tuntia", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "päivä", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "päivä", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "kaksi päivää", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "päivä", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "viisi päivää", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 päivää", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "kuukausi", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "kuukausi", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "kuukausi", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "kaksi kuukautta", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "kaksi kuukautta", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "kolme kuukautta", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "kuukausi", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "viisi kuukautta", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 kuukautta", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "vuosi", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "vuosi", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "kaksi vuotta", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "vuosi", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "viisi vuotta", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('fi');
|
||||
test.equal(moment(30000).from(0), "muutaman sekunnin päästä", "prefix");
|
||||
test.equal(moment(0).from(30000), "muutama sekunti sitten", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('fi');
|
||||
test.equal(moment().fromNow(), "muutama sekunti sitten", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('fi');
|
||||
test.equal(moment().add({s:30}).fromNow(), "muutaman sekunnin päästä", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "viiden päivän päästä", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('fi');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "tänään klo 02.00", "today at the same time");
|
||||
test.equal(moment(a).add({ m: 25 }).calendar(), "tänään klo 02.25", "Now plus 25 min");
|
||||
test.equal(moment(a).add({ h: 1 }).calendar(), "tänään klo 03.00", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "huomenna klo 02.00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "tänään klo 01.00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "eilen klo 02.00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('fi');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format('dddd [klo] LT'), "today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [klo] LT'), "today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [klo] LT'), "today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('fi');
|
||||
|
||||
for (var i = 2; i < 7; i++) {
|
||||
var m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), "today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), "today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[viime] dddd[na] [klo] LT'), "today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('fi');
|
||||
var weeksAgo = moment().subtract({ w: 1 });
|
||||
var weeksFromNow = moment().add({ w: 1 });
|
||||
|
||||
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "yksi viikko sitten");
|
||||
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "yhden viikon päästä");
|
||||
|
||||
weeksAgo = moment().subtract({ w: 2 });
|
||||
weeksFromNow = moment().add({ w: 2 });
|
||||
|
||||
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "kaksi viikkoa sitten");
|
||||
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "kaden viikon päästä");
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
241
node_modules/moment/test/lang/fr-ca.js
generated
vendored
Normal file
241
node_modules/moment/test/lang/fr-ca.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
French
|
||||
*************************************************/
|
||||
|
||||
exports["lang:fr-ca"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('fr-ca');
|
||||
var tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('fr-ca');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14ème 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'dim., 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2ème 02 février févr.'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8ème 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45ème day of the year'],
|
||||
['L', '2010-02-14'],
|
||||
['LL', '14 février 2010'],
|
||||
['LLL', '14 février 2010 15:25'],
|
||||
['LLLL', 'dimanche 14 février 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('fr');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2ème', '2ème');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3ème', '3ème');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4ème', '4ème');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5ème', '5ème');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6ème', '6ème');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7ème', '7ème');
|
||||
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, 14]).format('DDDo'), '14ème', '14ème');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15ème', '15ème');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16ème', '16ème');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17ème', '17è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, 24]).format('DDDo'), '24ème', '24ème');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25ème', '25ème');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26ème', '26ème');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27ème', '27è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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('fr');
|
||||
var expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('fr');
|
||||
var expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('fr');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "quelques secondes", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "une minute", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "une minute", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "une heure", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "une heure", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 heures", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 heures", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 heures", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un jour", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un jour", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 jours", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un jour", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 jours", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 jours", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mois", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mois", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mois", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mois", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mois", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mois", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mois", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mois", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mois", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "une année", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "une année", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 années", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "une année", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 années", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('fr');
|
||||
test.equal(moment(30000).from(0), "dans quelques secondes", "prefix");
|
||||
test.equal(moment(0).from(30000), "il y a quelques secondes", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('fr');
|
||||
test.equal(moment().add({s:30}).fromNow(), "dans quelques secondes", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "dans 5 jours", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Demain à 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Aujourd'hui à 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Hier à 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [à] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [à] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [dernier à] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [dernier à] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"same all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
241
node_modules/moment/test/lang/fr.js
generated
vendored
Normal file
241
node_modules/moment/test/lang/fr.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
French
|
||||
*************************************************/
|
||||
|
||||
exports["lang:fr"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('fr');
|
||||
var tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('fr');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14ème 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'dim., 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2ème 02 février févr.'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8ème 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45ème day of the year'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 février 2010'],
|
||||
['LLL', '14 février 2010 15:25'],
|
||||
['LLLL', 'dimanche 14 février 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('fr');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2ème', '2ème');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3ème', '3ème');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4ème', '4ème');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5ème', '5ème');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6ème', '6ème');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7ème', '7ème');
|
||||
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, 14]).format('DDDo'), '14ème', '14ème');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15ème', '15ème');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16ème', '16ème');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17ème', '17è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, 24]).format('DDDo'), '24ème', '24ème');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25ème', '25ème');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26ème', '26ème');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27ème', '27è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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('fr');
|
||||
var expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('fr');
|
||||
var expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('fr');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "quelques secondes", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "une minute", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "une minute", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutes", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutes", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "une heure", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "une heure", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 heures", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 heures", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 heures", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un jour", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un jour", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 jours", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un jour", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 jours", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 jours", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mois", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mois", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mois", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mois", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mois", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mois", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mois", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mois", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mois", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "une année", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "une année", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 années", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "une année", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 années", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('fr');
|
||||
test.equal(moment(30000).from(0), "dans quelques secondes", "prefix");
|
||||
test.equal(moment(0).from(30000), "il y a quelques secondes", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('fr');
|
||||
test.equal(moment().add({s:30}).fromNow(), "dans quelques secondes", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "dans 5 jours", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Demain à 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Aujourd'hui à 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Hier à 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [à] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [à] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [dernier à] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [dernier à] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"same all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
232
node_modules/moment/test/lang/gl.js
generated
vendored
Normal file
232
node_modules/moment/test/lang/gl.js
generated
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Galego
|
||||
*************************************************/
|
||||
|
||||
exports["lang:gl"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('gl');
|
||||
var tests = "Xaneiro Xan._Febreiro Feb._Marzo Mar._Abril Abr._Maio Mai._Xuño Xuñ._Xullo Xul._Agosto Ago._Setembro Set._Octubro Out._Novembro Nov._Decembro Dec.".split("_");
|
||||
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('es');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º');
|
||||
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, 14]).format('DDDo'), '14º', '14º');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
|
||||
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, 24]).format('DDDo'), '24º', '24º');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('gl');
|
||||
var expected = "Xaneiro Xan._Febreiro Feb._Marzo Mar._Abril Abr._Maio Mai._Xuño Xuñ._Xullo Xul._Agosto Ago._Setembro Set._Octubro Out._Novembro Nov._Decembro Dec.".split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('gl');
|
||||
var expected = "Domingo Dom. Do_Luns Lun. Lu_Martes Mar. Ma_Mércores Mér. Mé_Xoves Xov. Xo_Venres Ven. Ve_Sábado Sáb. Sá".split("_");
|
||||
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('gl');
|
||||
var start = moment([2007, 1, 28]);
|
||||
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "uns segundo", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minuto", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minuto", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutos", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutos", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "unha hora", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "unha hora", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 horas", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 horas", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 horas", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un día", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un día", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 días", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un día", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 días", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 días", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mes", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mes", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mes", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 meses", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 meses", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 meses", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mes", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 meses", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 meses", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un ano", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un ano", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anos", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un ano", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anos", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('gl');
|
||||
test.equal(moment(30000).from(0), "en uns segundo", "prefix");
|
||||
test.equal(moment(0).from(30000), "fai uns segundo", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('gl');
|
||||
test.equal(moment().fromNow(), "fai uns segundo", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('gl');
|
||||
test.equal(moment().add({s:30}).fromNow(), "en uns segundo", "en unos segundos");
|
||||
test.equal(moment().add({d:5}).fromNow(), "en 5 días", "en 5 días");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('gl');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "hoxe ás 2:00", "today at the same time");
|
||||
test.equal(moment(a).add({ m: 25 }).calendar(), "hoxe ás 2:25", "Now plus 25 min");
|
||||
test.equal(moment(a).add({ h: 1 }).calendar(), "hoxe ás 3:00", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "mañá ás 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).add({ d: 1, h : -1 }).calendar(), "mañá a 1:00", "tomorrow minus 1 hour");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "hoxe a 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "onte á 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('gl');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), "Today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('gl');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[o] dddd [pasado ' + ((m.hours() !== 1) ? 'ás' : 'a') + '] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('gl');
|
||||
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();
|
||||
},
|
||||
|
||||
"regression tests" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('gl');
|
||||
|
||||
var lastWeek = moment().subtract({ d: 4 }).hours(1);
|
||||
test.equal(lastWeek.calendar(), lastWeek.format('[o] dddd [pasado a] LT'), "1 o'clock bug");
|
||||
|
||||
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
250
node_modules/moment/test/lang/hu.js
generated
vendored
Normal file
250
node_modules/moment/test/lang/hu.js
generated
vendored
Normal file
@@ -0,0 +1,250 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
/**************************************************
|
||||
English
|
||||
*************************************************/
|
||||
|
||||
exports["lang:hu"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('hu');
|
||||
var tests = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(16);
|
||||
moment.lang('hu');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, HH:mm:ss', 'vasárnap, február 14. 2010, 15:25:50'],
|
||||
['ddd, HH', 'v, 15'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 február feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14. 14'],
|
||||
['d do dddd ddd', '0 0. vasárnap v'],
|
||||
['DDD DDDo DDDD', '45 45. 045'],
|
||||
['w wo ww', '8 8. 08'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['\\az év DDDo n\\apj\\a', 'az év 45. napja'],
|
||||
['L', '2010.02.14.'],
|
||||
['LL', '2010. február 14.'],
|
||||
['LLL', '2010. február 14., 15:25'],
|
||||
['LLLL', '2010. február 14., vasárnap 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('hu');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('hu');
|
||||
var expected = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('hu');
|
||||
var expected = 'vasárnap v_hétfő h_kedd k_szerda sze_csütörtök cs_péntek p_szombat szo'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('hu');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "néhány másodperc", "44 másodperc = néhány másodperc");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "egy perc", "45 másodperc = egy perc");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "egy perc", "89 másodperc = egy perc");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 perc", "90 másodperc = 2 perc");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 perc", "44 perc = 44 perc");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "egy óra", "45 perc = egy óra");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "egy óra", "89 perc = egy óra");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 óra", "90 perc = 2 óra");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 óra", "5 óra = 5 óra");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 óra", "21 óra = 21 óra");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "egy nap", "22 óra = egy nap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "egy nap", "35 óra = egy nap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 nap", "36 óra = 2 nap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "egy nap", "1 nap = egy nap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 nap", "5 nap = 5 nap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 nap", "25 nap = 25 nap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "egy hónap", "26 nap = egy hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "egy hónap", "30 nap = egy hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "egy hónap", "45 nap = egy hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 hónap", "46 nap = 2 hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 hónap", "75 nap = 2 hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 hónap", "76 nap = 3 hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "egy hónap", "1 hónap = egy hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 hónap", "5 hónap = 5 hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 hónap", "344 nap = 11 hónap");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "egy év", "345 nap = egy év");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "egy év", "547 nap = egy év");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 év", "548 nap = 2 év");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "egy év", "1 év = egy év");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 év", "5 év = 5 év");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('hu');
|
||||
test.equal(moment(30000).from(0), "néhány másodperc múlva", "prefix");
|
||||
test.equal(moment(0).from(30000), "néhány másodperce", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('hu');
|
||||
test.equal(moment().fromNow(), "néhány másodperce", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('hu');
|
||||
test.equal(moment().add({s:30}).fromNow(), "néhány másodperc múlva", "néhány másodperc múlva");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5 nap múlva", "5 nap múlva");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('hu');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "ma 2:00-kor", "today at the same time");
|
||||
test.equal(moment(a).add({ m: 25 }).calendar(), "ma 2:25-kor", "Now plus 25 min");
|
||||
test.equal(moment(a).add({ h: 1 }).calendar(), "ma 3:00-kor", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "holnap 2:00-kor", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "ma 1:00-kor", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "tegnap 2:00-kor", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('hu');
|
||||
|
||||
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(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('['+days[m.day()]+'] LT[-kor]'), "today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('['+days[m.day()]+'] LT[-kor]'), "today + " + i + " days end of day");
|
||||
}
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('hu');
|
||||
|
||||
var days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_');
|
||||
|
||||
for (var i = 2; i < 7; i++) {
|
||||
var m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('múlt ['+days[m.day()]+'] LT[-kor]'), "today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('múlt ['+days[m.day()]+'] LT[-kor]'), "today - " + i + " days beginning of day");
|
||||
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();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('hu');
|
||||
var weeksAgo = moment().subtract({ w: 1 });
|
||||
var weeksFromNow = moment().add({ w: 1 });
|
||||
|
||||
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "egy héte");
|
||||
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "egy hét múlva");
|
||||
|
||||
weeksAgo = moment().subtract({ w: 2 });
|
||||
weeksFromNow = moment().add({ w: 2 });
|
||||
|
||||
test.equal(weeksAgo.calendar(), weeksAgo.format('L'), "2 hete");
|
||||
test.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), "2 hét múlva");
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
254
node_modules/moment/test/lang/is.js
generated
vendored
Normal file
254
node_modules/moment/test/lang/is.js
generated
vendored
Normal file
@@ -0,0 +1,254 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Icelandic
|
||||
*************************************************/
|
||||
|
||||
exports["lang:is"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('is');
|
||||
var tests = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('is');
|
||||
var a = [
|
||||
['dddd, Do MMMM YYYY, h:mm:ss a', 'sunnudagur, 14. febrúar 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'sun, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 febrúar feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14. febrúar 2010'],
|
||||
['LLL', '14. febrúar 2010 kl. 15:25'],
|
||||
['LLLL', 'sunnudagur, 14. febrúar 2010 kl. 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('is');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('is');
|
||||
var expected = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('is');
|
||||
var expected = 'sunnudagur sun Su_mánudagur mán Má_þriðjudagur þri Þr_miðvikudagur mið Mi_fimmtudagur fim Fi_föstudagur fös Fö_laugardagur lau La'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(34);
|
||||
moment.lang('is');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "nokkrar sekúndur", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "mínúta", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "mínúta", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 mínútur", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 mínútur", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:21}), true), "21 mínúta", "21 minutes = 21 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "klukkustund", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "klukkustund", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 klukkustundir", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 klukkustundir", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 klukkustund", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "dagur", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "dagur", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dagar", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "dagur", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dagar", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dagar", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:11}), true), "11 dagar", "11 days = 11 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:21}), true), "21 dagur", "21 days = 21 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "mánuður", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "mánuður", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "mánuður", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mánuðir", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mánuðir", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mánuðir", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "mánuður", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mánuðir", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mánuðir", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "ár", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "ár", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 ár", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "ár", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 ár", "5 years = 5 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:21}), true), "21 ár", "21 years = 21 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(3);
|
||||
moment.lang('is');
|
||||
test.equal(moment(30000).from(0), "eftir nokkrar sekúndur", "prefix");
|
||||
test.equal(moment(0).from(30000), "fyrir nokkrum sekúndum síðan", "suffix");
|
||||
test.equal(moment().subtract({m:1}).fromNow(), "fyrir mínútu síðan", "a minute ago");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('is');
|
||||
test.equal(moment().fromNow(), "fyrir nokkrum sekúndum síðan", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(3);
|
||||
moment.lang('is');
|
||||
test.equal(moment().add({s:30}).fromNow(), "eftir nokkrar sekúndur", "in a few seconds");
|
||||
test.equal(moment().add({m:1}).fromNow(), "eftir mínútu", "in a minute");
|
||||
test.equal(moment().add({d:5}).fromNow(), "eftir 5 daga", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "á morgun kl. 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "í dag kl. 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "í gær kl. 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [kl.] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [kl.] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[síðasta] dddd [kl.] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
241
node_modules/moment/test/lang/it.js
generated
vendored
Normal file
241
node_modules/moment/test/lang/it.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Italian
|
||||
*************************************************/
|
||||
|
||||
exports["lang:it"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('it');
|
||||
var tests = 'Gennaio Gen_Febbraio Feb_Marzo Mar_Aprile Apr_Maggio Mag_Giugno Giu_Luglio Lug_Agosto Ago_Settembre Set_Ottobre Ott_Novembre Nov_Dicembre Dic'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('it');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Domenica, Febbraio 14º 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Dom, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2º 02 Febbraio Feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8º 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45º day of the year'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 Febbraio 2010'],
|
||||
['LLL', '14 Febbraio 2010 15:25'],
|
||||
['LLLL', 'Domenica, 14 Febbraio 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('it');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º');
|
||||
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, 14]).format('DDDo'), '14º', '14º');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
|
||||
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, 24]).format('DDDo'), '24º', '24º');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('it');
|
||||
var expected = 'Gennaio Gen_Febbraio Feb_Marzo Mar_Aprile Apr_Maggio Mag_Giugno Giu_Luglio Lug_Agosto Ago_Settembre Set_Ottobre Ott_Novembre Nov_Dicembre Dic'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('it');
|
||||
var expected = 'Domenica Dom D_Lunedì Lun L_Martedì Mar Ma_Mercoledì Mer Me_Giovedì Gio G_Venerdì Ven V_Sabato Sab S'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('it');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "secondi", "44 seconds = seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minuto", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minuto", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuti", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuti", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "un'ora", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "un'ora", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 ore", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 ore", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 ore", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "un giorno", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "un giorno", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 giorni", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "un giorno", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 giorni", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 giorni", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "un mese", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "un mese", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "un mese", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 mesi", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 mesi", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 mesi", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "un mese", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 mesi", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 mesi", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un anno", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un anno", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anni", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un anno", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anni", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('it');
|
||||
test.equal(moment(30000).from(0), "in secondi", "prefix");
|
||||
test.equal(moment(0).from(30000), "secondi fa", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('it');
|
||||
test.equal(moment().add({s:30}).fromNow(), "in secondi", "in seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "in 5 giorni", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Domani alle 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Oggi alle 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Ieri alle 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [alle] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [alle] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[lo scorso] dddd [alle] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[lo scorso] dddd [alle] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
208
node_modules/moment/test/lang/ja.js
generated
vendored
Normal file
208
node_modules/moment/test/lang/ja.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Japanese
|
||||
*************************************************/
|
||||
|
||||
exports["lang:jp"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('ja');
|
||||
var tests = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('ja');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, a h:mm:ss', '日曜日, 2月 14 2010, 午後 3:25:50'],
|
||||
['ddd, Ah', '日, 午後3'],
|
||||
['M Mo MM MMMM MMM', '2 2 02 2月 2月'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14 14'],
|
||||
['d do dddd ddd dd', '0 0 日曜日 日 日'],
|
||||
['DDD DDDo DDDD', '45 45 045'],
|
||||
['w wo ww', '8 8 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', '午後 午後'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45 day of the year'],
|
||||
['L', '2010/02/14'],
|
||||
['LL', '2010年2月14日'],
|
||||
['LLL', '2010年2月14日午後3時25分'],
|
||||
['LLLL', '2010年2月14日午後3時25分 日曜日']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('ja');
|
||||
var expected = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('ja');
|
||||
var expected = '日曜日 日 日_月曜日 月 月_火曜日 火 火_水曜日 水 水_木曜日 木 木_金曜日 金 金_土曜日 土 土'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('ja');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "数秒", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "1分", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "1分", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2分", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44分", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "1時間", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "1時間", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2時間", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5時間", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21時間", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "1日", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "1日", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2日", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "1日", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5日", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25日", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "1ヶ月", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "1ヶ月", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "1ヶ月", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2ヶ月", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2ヶ月", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3ヶ月", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "1ヶ月", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5ヶ月", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11ヶ月", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "1年", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "1年", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2年", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "1年", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5年", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ja');
|
||||
test.equal(moment(30000).from(0), "数秒後", "prefix");
|
||||
test.equal(moment(0).from(30000), "数秒前", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('ja');
|
||||
test.equal(moment().fromNow(), "数秒前", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ja');
|
||||
test.equal(moment().add({s:30}).fromNow(), "数秒後", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5日後", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('ja');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "今日 午前2時0分", "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時0分", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "明日 午前2時0分", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "今日 午前1時0分", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "昨日 午前2時0分", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ja');
|
||||
|
||||
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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[来週]dddd LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[来週]dddd LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ja');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[前週]dddd LT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[前週]dddd LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[前週]dddd LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('ja');
|
||||
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();
|
||||
}
|
||||
};
|
||||
208
node_modules/moment/test/lang/jp.js
generated
vendored
Normal file
208
node_modules/moment/test/lang/jp.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Japanese
|
||||
*************************************************/
|
||||
|
||||
exports["lang:jp"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('jp');
|
||||
var tests = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('jp');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, a h:mm:ss', '日曜日, 2月 14 2010, 午後 3:25:50'],
|
||||
['ddd, Ah', '日, 午後3'],
|
||||
['M Mo MM MMMM MMM', '2 2 02 2月 2月'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14 14'],
|
||||
['d do dddd ddd dd', '0 0 日曜日 日 日'],
|
||||
['DDD DDDo DDDD', '45 45 045'],
|
||||
['w wo ww', '8 8 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', '午後 午後'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45 day of the year'],
|
||||
['L', '2010/02/14'],
|
||||
['LL', '2010年2月14日'],
|
||||
['LLL', '2010年2月14日午後3時25分'],
|
||||
['LLLL', '2010年2月14日午後3時25分 日曜日']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('jp');
|
||||
var expected = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('jp');
|
||||
var expected = '日曜日 日 日_月曜日 月 月_火曜日 火 火_水曜日 水 水_木曜日 木 木_金曜日 金 金_土曜日 土 土'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('jp');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "数秒", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "1分", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "1分", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2分", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44分", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "1時間", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "1時間", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2時間", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5時間", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21時間", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "1日", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "1日", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2日", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "1日", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5日", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25日", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "1ヶ月", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "1ヶ月", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "1ヶ月", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2ヶ月", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2ヶ月", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3ヶ月", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "1ヶ月", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5ヶ月", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11ヶ月", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "1年", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "1年", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2年", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "1年", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5年", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('jp');
|
||||
test.equal(moment(30000).from(0), "数秒後", "prefix");
|
||||
test.equal(moment(0).from(30000), "数秒前", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('jp');
|
||||
test.equal(moment().fromNow(), "数秒前", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('jp');
|
||||
test.equal(moment().add({s:30}).fromNow(), "数秒後", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5日後", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('jp');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "今日 午前2時0分", "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時0分", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "明日 午前2時0分", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "今日 午前1時0分", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "昨日 午前2時0分", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('jp');
|
||||
|
||||
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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[来週]dddd LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[来週]dddd LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('jp');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[前週]dddd LT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[前週]dddd LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[前週]dddd LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('jp');
|
||||
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();
|
||||
}
|
||||
};
|
||||
247
node_modules/moment/test/lang/ko.js
generated
vendored
Normal file
247
node_modules/moment/test/lang/ko.js
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Korean
|
||||
*************************************************/
|
||||
|
||||
exports["lang:kr"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('ko');
|
||||
var tests = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('ko');
|
||||
var a = [
|
||||
['YYYY년 MMMM Do dddd a h:mm:ss', '2010년 2월 14일 일요일 오후 3:25:50'],
|
||||
['ddd A h', '일 오후 3'],
|
||||
['M Mo MM MMMM MMM', '2 2일 02 2월 2월'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14일 14'],
|
||||
['d do dddd ddd dd', '0 0일 일요일 일 일'],
|
||||
['DDD DDDo DDDD', '45 45일 045'],
|
||||
['w wo ww', '8 8일 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', '오후 오후'],
|
||||
['일년 중 DDDo째 되는 날', '일년 중 45일째 되는 날'],
|
||||
['L', '2010.02.14'],
|
||||
['LL', '2010년 2월 14일'],
|
||||
['LLL', '2010년 2월 14일 오후 3시 25분'],
|
||||
['LLLL', '2010년 2월 14일 일요일 오후 3시 25분']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('ko');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1일', '1일');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2일', '2일');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3일', '3일');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4일', '4일');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5일', '5일');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6일', '6일');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7일', '7일');
|
||||
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, 14]).format('DDDo'), '14일', '14일');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15일', '15일');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16일', '16일');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17일', '17일');
|
||||
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, 24]).format('DDDo'), '24일', '24일');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25일', '25일');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26일', '26일');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27일', '27일');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('ko');
|
||||
var expected = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('ko');
|
||||
var expected = '일요일 일 일_월요일 월 월_화요일 화 화_수요일 수 수_목요일 목 목_금요일 금 금_토요일 토 토'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('ko');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "몇초", "44초 = 몇초");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "일분", "45초 = 일분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "일분", "89초 = 일분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2분", "90초 = 2분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44분", "44분 = 44분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "한시간", "45분 = 한시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "한시간", "89분 = 한시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2시간", "90분 = 2시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5시간", "5시간 = 5시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21시간", "21시간 = 21시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "하루", "22시간 = 하루");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "하루", "35시간 = 하루");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2일", "36시간 = 2일");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "하루", "하루 = 하루");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5일", "5일 = 5일");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25일", "25일 = 25일");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "한달", "26일 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "한달", "30일 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "한달", "45일 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2달", "46일 = 2달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2달", "75일 = 2달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3달", "76일 = 3달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "한달", "1달 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5달", "5달 = 5달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11달", "344일 = 11달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "일년", "345일 = 일년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "일년", "547일 = 일년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2년", "548일 = 2년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "일년", "일년 = 일년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5년", "5년 = 5년");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ko');
|
||||
test.equal(moment(30000).from(0), "몇초 후", "prefix");
|
||||
test.equal(moment(0).from(30000), "몇초 전", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('ko');
|
||||
test.equal(moment().fromNow(), "몇초 전", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ko');
|
||||
test.equal(moment().add({s:30}).fromNow(), "몇초 후", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5일 후", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "내일 오전 2시 00분", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "오늘 오전 1시 00분", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "어제 오전 2시 00분", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('지난주 dddd LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('지난주 dddd LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
247
node_modules/moment/test/lang/kr.js
generated
vendored
Normal file
247
node_modules/moment/test/lang/kr.js
generated
vendored
Normal file
@@ -0,0 +1,247 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Korean
|
||||
*************************************************/
|
||||
|
||||
exports["lang:kr"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('kr');
|
||||
var tests = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('kr');
|
||||
var a = [
|
||||
['YYYY년 MMMM Do dddd a h:mm:ss', '2010년 2월 14일 일요일 오후 3:25:50'],
|
||||
['ddd A h', '일 오후 3'],
|
||||
['M Mo MM MMMM MMM', '2 2일 02 2월 2월'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14일 14'],
|
||||
['d do dddd ddd dd', '0 0일 일요일 일 일'],
|
||||
['DDD DDDo DDDD', '45 45일 045'],
|
||||
['w wo ww', '8 8일 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', '오후 오후'],
|
||||
['일년 중 DDDo째 되는 날', '일년 중 45일째 되는 날'],
|
||||
['L', '2010.02.14'],
|
||||
['LL', '2010년 2월 14일'],
|
||||
['LLL', '2010년 2월 14일 오후 3시 25분'],
|
||||
['LLLL', '2010년 2월 14일 일요일 오후 3시 25분']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('kr');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1일', '1일');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2일', '2일');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3일', '3일');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4일', '4일');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5일', '5일');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6일', '6일');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7일', '7일');
|
||||
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, 14]).format('DDDo'), '14일', '14일');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15일', '15일');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16일', '16일');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17일', '17일');
|
||||
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, 24]).format('DDDo'), '24일', '24일');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25일', '25일');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26일', '26일');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27일', '27일');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('kr');
|
||||
var expected = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('kr');
|
||||
var expected = '일요일 일 일_월요일 월 월_화요일 화 화_수요일 수 수_목요일 목 목_금요일 금 금_토요일 토 토'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('kr');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "몇초", "44초 = 몇초");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "일분", "45초 = 일분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "일분", "89초 = 일분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2분", "90초 = 2분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44분", "44분 = 44분");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "한시간", "45분 = 한시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "한시간", "89분 = 한시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2시간", "90분 = 2시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5시간", "5시간 = 5시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21시간", "21시간 = 21시간");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "하루", "22시간 = 하루");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "하루", "35시간 = 하루");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2일", "36시간 = 2일");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "하루", "하루 = 하루");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5일", "5일 = 5일");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25일", "25일 = 25일");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "한달", "26일 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "한달", "30일 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "한달", "45일 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2달", "46일 = 2달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2달", "75일 = 2달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3달", "76일 = 3달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "한달", "1달 = 한달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5달", "5달 = 5달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11달", "344일 = 11달");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "일년", "345일 = 일년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "일년", "547일 = 일년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2년", "548일 = 2년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "일년", "일년 = 일년");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5년", "5년 = 5년");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('kr');
|
||||
test.equal(moment(30000).from(0), "몇초 후", "prefix");
|
||||
test.equal(moment(0).from(30000), "몇초 전", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('kr');
|
||||
test.equal(moment().fromNow(), "몇초 전", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('kr');
|
||||
test.equal(moment().add({s:30}).fromNow(), "몇초 후", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5일 후", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "내일 오전 2시 00분", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "오늘 오전 1시 00분", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "어제 오전 2시 00분", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('지난주 dddd LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('지난주 dddd LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/nb.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/nb.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Norwegian bokmål
|
||||
*************************************************/
|
||||
|
||||
exports["lang:nb"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('nb');
|
||||
var tests = 'januar jan_februar feb_mars mar_april apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('nb');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'søndag, februar 14. 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'søn, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 februar feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '2010-02-14'],
|
||||
['LL', '14 februar 2010'],
|
||||
['LLL', '14 februar 2010 15:25'],
|
||||
['LLLL', 'søndag 14 februar 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('nb');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('nb');
|
||||
var expected = 'januar jan_februar feb_mars mar_april apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('nb');
|
||||
var expected = 'søndag søn sø_mandag man ma_tirsdag tir ti_onsdag ons on_torsdag tor to_fredag fre fr_lørdag lør lø'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('nb');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "noen sekunder", "44 sekunder = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "ett minutt", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "ett minutt", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutter", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutter", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "en time", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "en time", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 timer", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 timer", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 timer", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "en dag", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "en dag", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dager", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "en dag", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dager", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dager", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "en måned", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "en måned", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "en måned", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 måneder", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 måneder", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 måneder", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "en måned", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 måneder", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 måneder", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "ett år", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "ett år", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 år", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "ett år", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 år", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('nb');
|
||||
test.equal(moment(30000).from(0), "om noen sekunder", "prefix");
|
||||
test.equal(moment(0).from(30000), "for noen sekunder siden", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('nb');
|
||||
test.equal(moment().fromNow(), "for noen sekunder siden", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('nb');
|
||||
test.equal(moment().add({s:30}).fromNow(), "om noen sekunder", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "om 5 dager", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "I morgen klokken 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "I dag klokken 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "I går klokken 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [klokken] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [klokken] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[Forrige] dddd [klokken] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[Forrige] dddd [klokken] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
258
node_modules/moment/test/lang/nl.js
generated
vendored
Normal file
258
node_modules/moment/test/lang/nl.js
generated
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Dutch
|
||||
*************************************************/
|
||||
|
||||
exports["lang:nl"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('nl');
|
||||
var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('nl');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, HH:mm:ss', 'zondag, februari 14de 2010, 15:25:50'],
|
||||
['ddd, HH', 'zo., 15'],
|
||||
['M Mo MM MMMM MMM', '2 2de 02 februari feb.'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8ste 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45ste day of the year'],
|
||||
['L', '14-02-2010'],
|
||||
['LL', '14 februari 2010'],
|
||||
['LLL', '14 februari 2010 15:25'],
|
||||
['LLLL', 'zondag 14 februari 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('nl');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3de', '3de');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4de', '4de');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5de', '5de');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6de', '6de');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7de', '7de');
|
||||
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, 14]).format('DDDo'), '14de', '14de');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15de', '15de');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16de', '16de');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17de', '17de');
|
||||
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, 24]).format('DDDo'), '24ste', '24ste');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25ste', '25ste');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26ste', '26ste');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27ste', '27ste');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('nl');
|
||||
var expected = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('nl');
|
||||
var expected = 'zondag zo. Zo_maandag ma. Ma_dinsdag di. Di_woensdag wo. Wo_donderdag do. Do_vrijdag vr. Vr_zaterdag za. Za'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('nl');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "een paar seconden", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "één minuut", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "één minuut", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuten", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuten", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "één uur", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "één uur", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 uur", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 uur", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 uur", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "één dag", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "één dag", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dagen", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "één dag", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dagen", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dagen", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "één maand", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "één maand", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "één maand", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 maanden", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 maanden", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 maanden", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "één maand", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 maanden", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 maanden", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "één jaar", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "één jaar", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 jaar", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "één jaar", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 jaar", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('nl');
|
||||
test.equal(moment(30000).from(0), "over een paar seconden", "prefix");
|
||||
test.equal(moment(0).from(30000), "een paar seconden geleden", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('nl');
|
||||
test.equal(moment().fromNow(), "een paar seconden geleden", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('nl');
|
||||
test.equal(moment().add({s:30}).fromNow(), "over een paar seconden", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "over 5 dagen", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Morgen om 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Vandaag om 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Gisteren om 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [om] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [om] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[afgelopen] dddd [om] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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');
|
||||
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
249
node_modules/moment/test/lang/pl.js
generated
vendored
Normal file
249
node_modules/moment/test/lang/pl.js
generated
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Polish
|
||||
*************************************************/
|
||||
|
||||
exports["lang:pl"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('pl');
|
||||
var tests = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('pl');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'niedziela, luty 14. 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'nie, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 luty lut'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '14-02-2010'],
|
||||
['LL', '14 luty 2010'],
|
||||
['LLL', '14 luty 2010 15:25'],
|
||||
['LLLL', 'niedziela, 14 luty 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('pl');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('pl');
|
||||
var expected = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('pl');
|
||||
var expected = 'niedziela nie N_poniedziałek pon Pn_wtorek wt Wt_środa śr Śr_czwartek czw Cz_piątek pt Pt_sobota sb So'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('pl');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "kilka sekund", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "minuta", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "minuta", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuty", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuty", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "godzina", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "godzina", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 godziny", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 godzin", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 godzin", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "1 dzień", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "1 dzień", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dni", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "1 dzień", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dni", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dni", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "miesiąc", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "miesiąc", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "miesiąc", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 miesiące", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 miesiące", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 miesiące", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "miesiąc", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 miesięcy", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 miesięcy", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "rok", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "rok", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 lata", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "rok", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 lat", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('pl');
|
||||
test.equal(moment(30000).from(0), "za kilka sekund", "prefix");
|
||||
test.equal(moment(0).from(30000), "kilka sekund temu", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('pl');
|
||||
test.equal(moment().fromNow(), "kilka sekund temu", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(3);
|
||||
moment.lang('pl');
|
||||
test.equal(moment().add({s:30}).fromNow(), "za kilka sekund", "in a few seconds");
|
||||
test.equal(moment().add({h:1}).fromNow(), "za godzinę", "in an hour");
|
||||
test.equal(moment().add({d:5}).fromNow(), "za 5 dni", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Jutro o 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Dziś o 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Wczoraj o 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[W] dddd [o] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[W] dddd [o] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[W zeszły/łą] dddd [o] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[W zeszły/łą] dddd [o] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
241
node_modules/moment/test/lang/pt-br.js
generated
vendored
Normal file
241
node_modules/moment/test/lang/pt-br.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Portuguese - Brazilian
|
||||
*************************************************/
|
||||
|
||||
exports["lang:pt-br"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('pt-br');
|
||||
var tests = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('pt-br');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Dom, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Fev'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14º 14'],
|
||||
['d do dddd ddd', '0 0º Domingo Dom'],
|
||||
['DDD DDDo DDDD', '45 45º 045'],
|
||||
['w wo ww', '8 8º 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45º day of the year'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 de Fevereiro de 2010'],
|
||||
['LLL', '14 de Fevereiro de 2010 15:25'],
|
||||
['LLLL', 'Domingo, 14 de Fevereiro de 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('pt-br');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º');
|
||||
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, 14]).format('DDDo'), '14º', '14º');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
|
||||
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, 24]).format('DDDo'), '24º', '24º');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('pt-br');
|
||||
var expected = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('pt-br');
|
||||
var expected = 'Domingo Dom_Segunda-feira Seg_Terça-feira Ter_Quarta-feira Qua_Quinta-feira Qui_Sexta-feira Sex_Sábado Sáb'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('pt-br');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "segundos", "44 seconds = seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "um minuto", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "um minuto", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutos", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutos", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "uma hora", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "uma hora", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 horas", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 horas", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 horas", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "um dia", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "um dia", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dias", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "um dia", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dias", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dias", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "um mês", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "um mês", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "um mês", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 meses", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 meses", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 meses", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "um mês", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 meses", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 meses", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "um ano", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "um ano", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anos", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "um ano", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anos", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('pt-br');
|
||||
test.equal(moment(30000).from(0), "em segundos", "prefix");
|
||||
test.equal(moment(0).from(30000), "segundos atrás", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('pt-br');
|
||||
test.equal(moment().add({s:30}).fromNow(), "em segundos", "in seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "em 5 dias", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Amanhã às 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Hoje às 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Ontem às 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [às] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [às] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
241
node_modules/moment/test/lang/pt.js
generated
vendored
Normal file
241
node_modules/moment/test/lang/pt.js
generated
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Portuguese
|
||||
*************************************************/
|
||||
|
||||
exports["lang:pt"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('pt');
|
||||
var tests = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('pt');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Domingo, Fevereiro 14º 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Dom, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2º 02 Fevereiro Fev'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8º 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45º day of the year'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 de Fevereiro de 2010'],
|
||||
['LLL', '14 de Fevereiro de 2010 15:25'],
|
||||
['LLLL', 'Domingo, 14 de Fevereiro de 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('pt');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4º', '4º');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5º', '5º');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6º', '6º');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7º', '7º');
|
||||
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, 14]).format('DDDo'), '14º', '14º');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15º', '15º');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16º', '16º');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17º', '17º');
|
||||
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, 24]).format('DDDo'), '24º', '24º');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25º', '25º');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26º', '26º');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27º', '27º');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('pt');
|
||||
var expected = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('pt');
|
||||
var expected = 'Domingo Dom Dom_Segunda-feira Seg 2ª_Terça-feira Ter 3ª_Quarta-feira Qua 4ª_Quinta-feira Qui 5ª_Sexta-feira Sex 6ª_Sábado Sáb Sáb'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('pt');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "segundos", "44 seconds = seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "um minuto", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "um minuto", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minutos", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minutos", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "uma hora", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "uma hora", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 horas", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 horas", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 horas", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "um dia", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "um dia", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dias", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "um dia", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dias", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dias", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "um mês", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "um mês", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "um mês", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 meses", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 meses", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 meses", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "um mês", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 meses", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 meses", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "um ano", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "um ano", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 anos", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "um ano", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 anos", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('pt');
|
||||
test.equal(moment(30000).from(0), "em segundos", "prefix");
|
||||
test.equal(moment(0).from(30000), "segundos atrás", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('pt');
|
||||
test.equal(moment().add({s:30}).fromNow(), "em segundos", "in seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "em 5 dias", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Amanhã às 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Hoje às 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Ontem às 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [às] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [às] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format((m.day() === 0 || m.day() === 6) ? '[Último] dddd [às] LT' : '[Última] dddd [às] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/ro.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/ro.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Romanian
|
||||
*************************************************/
|
||||
|
||||
exports["lang:ro"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('ro');
|
||||
var tests = 'Ianuarie Ian_Februarie Feb_Martie Mar_Aprilie Apr_Mai Mai_Iunie Iun_Iulie Iul_August Aug_Septembrie Sep_Octombrie Oct_Noiembrie Noi_Decembrie Dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('ro');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss A', 'Duminică, Februarie 14 2010, 3:25:50 PM'],
|
||||
['ddd, hA', 'Dum, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2 02 Februarie Feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['\\a DDDo\\a zi \\a \\anului', 'a 45a zi a anului'],
|
||||
['L', '14/02/2010'],
|
||||
['LL', '14 Februarie 2010'],
|
||||
['LLL', '14 Februarie 2010 15:25'],
|
||||
['LLLL', 'Duminică, 14 Februarie 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('ro');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4', '4');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5', '5');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6', '6');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7', '7');
|
||||
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, 14]).format('DDDo'), '14', '14');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15', '15');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16', '16');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17', '17');
|
||||
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, 24]).format('DDDo'), '24', '24');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25', '25');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26', '26');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27', '27');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('ro');
|
||||
var expected = 'Ianuarie Ian_Februarie Feb_Martie Mar_Aprilie Apr_Mai Mai_Iunie Iun_Iulie Iul_August Aug_Septembrie Sep_Octombrie Oct_Noiembrie Noi_Decembrie Dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('ro');
|
||||
var expected = 'Duminică Dum Du_Luni Lun Lu_Marţi Mar Ma_Miercuri Mie Mi_Joi Joi Jo_Vineri Vin Vi_Sâmbătă Sâm Sâ'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('ro');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "câteva secunde", "44 secunde = câteva secunde");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "un minut", "45 secunde = un minut");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "un minut", "89 secunde = un minut");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minute", "90 secunde = 2 minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minute", "44 minute = 44 minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "o oră", "45 minute = o oră");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "o oră", "89 minute = o oră");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 ore", "90 minute = 2 ore");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 ore", "5 ore = 5 ore");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 ore", "21 ore = 21 ore");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "o zi", "22 ore = o zi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "o zi", "35 ore = o zi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 zile", "36 ore = 2 zile");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "o zi", "1 zi = o zi");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 zile", "5 zile = 5 zile");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 zile", "25 zile = 25 zile");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "o lună", "26 zile = o lună");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "o lună", "30 zile = o lună");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "o lună", "45 zile = o lună");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 luni", "46 zile = 2 luni");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 luni", "75 zile = 2 luni");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 luni", "76 zile = 3 luni");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "o lună", "1 lună = o lună");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 luni", "5 luni = 5 luni");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 luni", "344 zile = 11 luni");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "un an", "345 zile = un an");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "un an", "547 zile = un an");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 ani", "548 zile = 2 ani");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "un an", "1 an = un an");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 ani", "5 ani = 5 ani");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ro');
|
||||
test.equal(moment(30000).from(0), "peste câteva secunde", "prefix");
|
||||
test.equal(moment(0).from(30000), "câteva secunde în urmă", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('ro');
|
||||
test.equal(moment().fromNow(), "câteva secunde în urmă", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ro');
|
||||
test.equal(moment().add({s:30}).fromNow(), "peste câteva secunde", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "peste 5 zile", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('ro');
|
||||
|
||||
var a = moment().hours(2).minutes(0).seconds(0);
|
||||
|
||||
test.equal(moment(a).calendar(), "azi la 2:00", "today at the same time");
|
||||
test.equal(moment(a).add({ m: 25 }).calendar(), "azi la 2:25", "Now plus 25 min");
|
||||
test.equal(moment(a).add({ h: 1 }).calendar(), "azi la 3:00", "Now plus 1 hour");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "mâine la 2:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "azi la 1:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "ieri la 2:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ro');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format('dddd [la] LT'), "Today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [la] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [la] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ro');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('ro');
|
||||
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();
|
||||
}
|
||||
};
|
||||
280
node_modules/moment/test/lang/ru.js
generated
vendored
Normal file
280
node_modules/moment/test/lang/ru.js
generated
vendored
Normal file
@@ -0,0 +1,280 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Russian
|
||||
*************************************************/
|
||||
|
||||
exports["lang:ru"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('ru');
|
||||
var tests = 'январь янв_февраль фев_март мар_апрель апр_май май_июнь июн_июль июл_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('ru');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'воскресенье, февраль 14. 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'вск, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2. 02 февраль фев'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14. 14'],
|
||||
['d do dddd ddd dd', '0 0. воскресенье вск вс'],
|
||||
['DDD DDDo DDDD', '45 45. 045'],
|
||||
['w wo ww', '8 8. 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45. day of the year'],
|
||||
['L', '14.02.2010'],
|
||||
['LL', '14 февраля 2010 г.'],
|
||||
['LLL', '14 февраля 2010 г., 15:25'],
|
||||
['LLLL', 'воскресенье, 14 февраля 2010 г., 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('ru');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4.', '4.');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5.', '5.');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6.', '6.');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7.', '7.');
|
||||
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, 14]).format('DDDo'), '14.', '14.');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15.', '15.');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16.', '16.');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17.', '17.');
|
||||
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, 24]).format('DDDo'), '24.', '24.');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25.', '25.');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26.', '26.');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27.', '27.');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('ru');
|
||||
var expected = 'январь янв_февраль фев_март мар_апрель апр_май май_июнь июн_июль июл_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format month case" : function(test) {
|
||||
test.expect(24);
|
||||
moment.lang('ru');
|
||||
var months = {
|
||||
'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
|
||||
'accusative': 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_')
|
||||
};
|
||||
var i;
|
||||
for (i = 0; i < 12; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('D MMMM'), '1 ' + months.accusative[i], '1 ' + months.accusative[i]);
|
||||
test.equal(moment([2011, i, 1]).format('MMMM'), months.nominative[i], '1 ' + months.nominative[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('ru');
|
||||
var expected = 'воскресенье вск вс_понедельник пнд пн_вторник втр вт_среда срд ср_четверг чтв чт_пятница птн пт_суббота сбт сб'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(32);
|
||||
moment.lang('ru');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "несколько секунд", "44 seconds = seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "минута", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "минута", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 минуты", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 минуты", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "час", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "час", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 часа", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 часов", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 час", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "день", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "день", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 дня", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "день", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 дней", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:11}), true), "11 дней", "11 days = 11 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:21}), true), "21 день", "21 days = 21 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 дней", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "месяц", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "месяц", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "месяц", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 месяца", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 месяца", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 месяца", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "месяц", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 месяцев", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 месяцев", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "год", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "год", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 года", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "год", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 лет", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ru');
|
||||
test.equal(moment(30000).from(0), "через несколько секунд", "prefix");
|
||||
test.equal(moment(0).from(30000), "несколько секунд назад", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('ru');
|
||||
test.equal(moment().add({s:30}).fromNow(), "через несколько секунд", "in seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "через 5 дней", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('ru');
|
||||
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Завтра в 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Сегодня в 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Вчера в 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ru');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
function makeFormat(d) {
|
||||
return d.day() === 2 ? '[Во] dddd [в] LT' : '[В] dddd [в] LT';
|
||||
}
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('ru');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
function makeFormat(d) {
|
||||
switch (d.day()) {
|
||||
case 0:
|
||||
return '[В прошлое] dddd [в] LT';
|
||||
case 1:
|
||||
case 2:
|
||||
case 4:
|
||||
return '[В прошлый] dddd [в] LT';
|
||||
case 3:
|
||||
case 5:
|
||||
case 6:
|
||||
return '[В прошлую] dddd [в] LT';
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format(makeFormat(m)), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('ru');
|
||||
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();
|
||||
}
|
||||
};
|
||||
248
node_modules/moment/test/lang/sv.js
generated
vendored
Normal file
248
node_modules/moment/test/lang/sv.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
English
|
||||
*************************************************/
|
||||
|
||||
exports["lang:sv"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('sv');
|
||||
var tests = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober okt_november nov_december dec'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('sv');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'söndag, februari 14e 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'sön, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2a 02 februari feb'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8e 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45e day of the year'],
|
||||
['L', '2010-02-14'],
|
||||
['LL', '14 februari 2010'],
|
||||
['LLL', '14 februari 2010 15:25'],
|
||||
['LLLL', 'söndag 14 februari 2010 15:25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('sv');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4e', '4e');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5e', '5e');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6e', '6e');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7e', '7e');
|
||||
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, 14]).format('DDDo'), '14e', '14e');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15e', '15e');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16e', '16e');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17e', '17e');
|
||||
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, 24]).format('DDDo'), '24e', '24e');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25e', '25e');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26e', '26e');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27e', '27e');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('sv');
|
||||
var expected = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober okt_november nov_december dec'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('sv');
|
||||
var expected = 'söndag sön sö_måndag mån må_tisdag tis ti_onsdag ons on_torsdag tor to_fredag fre fr_lördag lör lö'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('sv');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "några sekunder", "44 sekunder = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "en minut", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "en minut", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 minuter", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 minuter", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "en timme", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "en timme", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 timmar", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 timmar", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 timmar", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "en dag", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "en dag", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 dagar", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "en dag", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 dagar", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 dagar", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "en månad", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "en månad", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "en månad", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 månader", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 månader", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 månader", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "en månad", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 månader", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 månader", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "ett år", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "ett år", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 år", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "ett år", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 år", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('sv');
|
||||
test.equal(moment(30000).from(0), "om några sekunder", "prefix");
|
||||
test.equal(moment(0).from(30000), "för några sekunder sen", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('sv');
|
||||
test.equal(moment().fromNow(), "för några sekunder sen", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('sv');
|
||||
test.equal(moment().add({s:30}).fromNow(), "om några sekunder", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "om 5 dagar", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "Imorgon klockan 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "Idag klockan 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "Igår klockan 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('dddd [klockan] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('dddd [klockan] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[Förra] dddd[en klockan] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[Förra] dddd[en klockan] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
259
node_modules/moment/test/lang/tr.js
generated
vendored
Normal file
259
node_modules/moment/test/lang/tr.js
generated
vendored
Normal file
@@ -0,0 +1,259 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Turkish
|
||||
*************************************************/
|
||||
|
||||
exports["lang:tr"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('tr');
|
||||
var tests = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
moment.lang('tr');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, h:mm:ss a', 'Pazar, Şubat 14\'üncü 2010, 3:25:50 pm'],
|
||||
['ddd, hA', 'Paz, 3PM'],
|
||||
['M Mo MM MMMM MMM', '2 2\'nci 02 Şubat Şub'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['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', '8 8\'inci 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', 'pm PM'],
|
||||
['yılın DDDo günü', 'yılın 45\'inci günü'],
|
||||
['L', '14.02.2010'],
|
||||
['LL', '14 Şubat 2010'],
|
||||
['LLL', '14 Şubat 2010 15:25'],
|
||||
['LLLL', 'Pazar, 14 Şubat 2010 15:25']
|
||||
],
|
||||
DDDo = [
|
||||
[359, '360\'ıncı'],
|
||||
[199, '200\'üncü'],
|
||||
[149, '150\'nci']
|
||||
],
|
||||
dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
DDDoDt,
|
||||
i;
|
||||
test.expect(a.length + DDDo.length);
|
||||
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
for (i = 0; i < DDDo.length; i++) {
|
||||
DDDoDt = moment([2010]);
|
||||
test.equal(DDDoDt.add('days', DDDo[i][0]).format('DDDo'), DDDo[i][1], DDDo[i][0] + ' ---> ' + DDDo[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format ordinal" : function(test) {
|
||||
test.expect(31);
|
||||
moment.lang('tr');
|
||||
test.equal(moment([2011, 0, 1]).format('DDDo'), '1\'inci', '1st');
|
||||
test.equal(moment([2011, 0, 2]).format('DDDo'), '2\'nci', '2nd');
|
||||
test.equal(moment([2011, 0, 3]).format('DDDo'), '3\'üncü', '3rd');
|
||||
test.equal(moment([2011, 0, 4]).format('DDDo'), '4\'üncü', '4th');
|
||||
test.equal(moment([2011, 0, 5]).format('DDDo'), '5\'inci', '5th');
|
||||
test.equal(moment([2011, 0, 6]).format('DDDo'), '6\'ncı', '6th');
|
||||
test.equal(moment([2011, 0, 7]).format('DDDo'), '7\'nci', '7th');
|
||||
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, 14]).format('DDDo'), '14\'üncü', '14th');
|
||||
test.equal(moment([2011, 0, 15]).format('DDDo'), '15\'inci', '15th');
|
||||
test.equal(moment([2011, 0, 16]).format('DDDo'), '16\'ncı', '16th');
|
||||
test.equal(moment([2011, 0, 17]).format('DDDo'), '17\'nci', '17th');
|
||||
test.equal(moment([2011, 0, 18]).format('DDDo'), '18\'inci', '18th');
|
||||
test.equal(moment([2011, 0, 19]).format('DDDo'), '19\'uncu', '19th');
|
||||
test.equal(moment([2011, 0, 20]).format('DDDo'), '20\'nci', '20th');
|
||||
|
||||
test.equal(moment([2011, 0, 21]).format('DDDo'), '21\'inci', '21th');
|
||||
test.equal(moment([2011, 0, 22]).format('DDDo'), '22\'nci', '22th');
|
||||
test.equal(moment([2011, 0, 23]).format('DDDo'), '23\'üncü', '23th');
|
||||
test.equal(moment([2011, 0, 24]).format('DDDo'), '24\'üncü', '24th');
|
||||
test.equal(moment([2011, 0, 25]).format('DDDo'), '25\'inci', '25th');
|
||||
test.equal(moment([2011, 0, 26]).format('DDDo'), '26\'ncı', '26th');
|
||||
test.equal(moment([2011, 0, 27]).format('DDDo'), '27\'nci', '27th');
|
||||
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();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('tr');
|
||||
var expected = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('tr');
|
||||
var expected = 'Pazar Paz Pz_Pazartesi Pts Pt_Salı Sal Sa_Çarşamba Çar Ça_Perşembe Per Pe_Cuma Cum Cu_Cumartesi Cts Ct'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('tr');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "birkaç saniye", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "bir dakika", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "bir dakika", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2 dakika", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44 dakika", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "bir saat", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "bir saat", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2 saat", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5 saat", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21 saat", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "bir gün", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "bir gün", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2 gün", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "bir gün", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5 gün", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25 gün", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "bir ay", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "bir ay", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "bir ay", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2 ay", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2 ay", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3 ay", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "bir ay", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5 ay", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11 ay", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "bir yıl", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "bir yıl", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2 yıl", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "bir yıl", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5 yıl", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('tr');
|
||||
test.equal(moment(30000).from(0), "birkaç saniye sonra", "prefix");
|
||||
test.equal(moment(0).from(30000), "birkaç saniye önce", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('tr');
|
||||
test.equal(moment().fromNow(), "birkaç saniye önce", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('tr');
|
||||
test.equal(moment().add({s:30}).fromNow(), "birkaç saniye sonra", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5 gün sonra", "in 5 days");
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "yarın saat 02:00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "bugün saat 01:00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "dün 02:00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[haftaya] dddd [saat] LT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[haftaya] dddd [saat] LT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"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");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[geçen hafta] dddd [saat] LT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[geçen hafta] dddd [saat] LT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
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();
|
||||
}
|
||||
};
|
||||
227
node_modules/moment/test/lang/zh-cn.js
generated
vendored
Normal file
227
node_modules/moment/test/lang/zh-cn.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Simplified Chinese
|
||||
*************************************************/
|
||||
|
||||
exports["lang:zh-cn"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('zh-cn');
|
||||
var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('zh-cn');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, a h:mm:ss', '星期日, 二月 14 2010, 下午 3:25:50'],
|
||||
['ddd, Ah', '周日, 下午3'],
|
||||
['M Mo MM MMMM MMM', '2 2 02 二月 2月'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14 14'],
|
||||
['d do dddd ddd dd', '0 0 星期日 周日 日'],
|
||||
['DDD DDDo DDDD', '45 45 045'],
|
||||
['w wo ww', '8 8 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', '下午 下午'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45 day of the year'],
|
||||
['L', '2010年2月14日'],
|
||||
['LL', '2010年2月14日'],
|
||||
['LLL', '2010年2月14日下午3点25'],
|
||||
['LLLL', '2010年2月14日星期日下午3点25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('zh-cn');
|
||||
var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('zh-cn');
|
||||
var expected = '星期日 周日 日_星期一 周一 一_星期二 周二 二_星期三 周三 三_星期四 周四 四_星期五 周五 五_星期六 周六 六'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('zh-cn');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "几秒", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "1分钟", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "1分钟", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2分钟", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44分钟", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "1小时", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "1小时", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2小时", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5小时", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21小时", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "1天", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "1天", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2天", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "1天", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5天", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25天", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "1个月", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "1个月", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "1个月", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2个月", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2个月", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3个月", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "1个月", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5个月", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11个月", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "1年", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "1年", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2年", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "1年", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5年", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('zh-cn');
|
||||
test.equal(moment(30000).from(0), "几秒内", "prefix");
|
||||
test.equal(moment(0).from(30000), "几秒前", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('zh-cn');
|
||||
test.equal(moment().fromNow(), "几秒前", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('zh-cn');
|
||||
test.equal(moment().add({s:30}).fromNow(), "几秒内", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5天内", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('zh-cn');
|
||||
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "明天早上2点00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "今天早上1点00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "昨天早上2点00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('zh-cn');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format('[下]ddddLT'), "Today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[下]ddddLT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[下]ddddLT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('zh-cn');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[上]ddddLT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[上]ddddLT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[上]ddddLT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('zh-cn');
|
||||
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();
|
||||
},
|
||||
|
||||
"meridiem" : function(test) {
|
||||
test.expect(10);
|
||||
moment.lang('zh-cn');
|
||||
|
||||
test.equal(moment([2011, 2, 23, 0, 0]).format('a'), "早上", "morning");
|
||||
test.equal(moment([2011, 2, 23, 9, 0]).format('a'), "上午", "before noon");
|
||||
test.equal(moment([2011, 2, 23, 12, 0]).format('a'), "中午", "noon");
|
||||
test.equal(moment([2011, 2, 23, 13, 0]).format('a'), "下午", "after noon");
|
||||
test.equal(moment([2011, 2, 23, 18, 0]).format('a'), "晚上", "night");
|
||||
|
||||
test.equal(moment([2011, 2, 23, 0, 0]).format('A'), "早上", "morning");
|
||||
test.equal(moment([2011, 2, 23, 9, 0]).format('A'), "上午", "before noon");
|
||||
test.equal(moment([2011, 2, 23, 12, 0]).format('A'), "中午", "noon");
|
||||
test.equal(moment([2011, 2, 23, 13, 0]).format('A'), "下午", "afternoon");
|
||||
test.equal(moment([2011, 2, 23, 18, 0]).format('A'), "晚上", "night");
|
||||
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
227
node_modules/moment/test/lang/zh-tw.js
generated
vendored
Normal file
227
node_modules/moment/test/lang/zh-tw.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
var moment = require("../../moment");
|
||||
|
||||
|
||||
/**************************************************
|
||||
Traditional Chinese
|
||||
*************************************************/
|
||||
|
||||
exports["lang:zh-tw"] = {
|
||||
"parse" : function(test) {
|
||||
test.expect(96);
|
||||
moment.lang('zh-tw');
|
||||
var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_");
|
||||
var i;
|
||||
function equalTest(input, mmm, i) {
|
||||
test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
|
||||
}
|
||||
for (i = 0; i < 12; i++) {
|
||||
tests[i] = tests[i].split(' ');
|
||||
equalTest(tests[i][0], 'MMM', i);
|
||||
equalTest(tests[i][1], 'MMM', i);
|
||||
equalTest(tests[i][0], 'MMMM', i);
|
||||
equalTest(tests[i][1], 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleLowerCase(), 'MMMM', i);
|
||||
equalTest(tests[i][0].toLocaleUpperCase(), 'MMMM', i);
|
||||
equalTest(tests[i][1].toLocaleUpperCase(), 'MMMM', i);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format" : function(test) {
|
||||
test.expect(18);
|
||||
moment.lang('zh-tw');
|
||||
var a = [
|
||||
['dddd, MMMM Do YYYY, a h:mm:ss', '星期日, 二月 14 2010, 下午 3:25:50'],
|
||||
['ddd, Ah', '週日, 下午3'],
|
||||
['M Mo MM MMMM MMM', '2 2 02 二月 2月'],
|
||||
['YYYY YY', '2010 10'],
|
||||
['D Do DD', '14 14 14'],
|
||||
['d do dddd ddd dd', '0 0 星期日 週日 日'],
|
||||
['DDD DDDo DDDD', '45 45 045'],
|
||||
['w wo ww', '8 8 08'],
|
||||
['h hh', '3 03'],
|
||||
['H HH', '15 15'],
|
||||
['m mm', '25 25'],
|
||||
['s ss', '50 50'],
|
||||
['a A', '下午 下午'],
|
||||
['t\\he DDDo \\d\\ay of t\\he ye\\ar', 'the 45 day of the year'],
|
||||
['L', '2010年2月14日'],
|
||||
['LL', '2010年2月14日'],
|
||||
['LLL', '2010年2月14日下午3點25'],
|
||||
['LLLL', '2010年2月14日星期日下午3點25']
|
||||
],
|
||||
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
|
||||
i;
|
||||
for (i = 0; i < a.length; i++) {
|
||||
test.equal(b.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format month" : function(test) {
|
||||
test.expect(12);
|
||||
moment.lang('zh-tw');
|
||||
var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"format week" : function(test) {
|
||||
test.expect(7);
|
||||
moment.lang('zh-tw');
|
||||
var expected = '星期日 週日 日_星期一 週一 一_星期二 週二 二_星期三 週三 三_星期四 週四 四_星期五 週五 五_星期六 週六 六'.split("_");
|
||||
var i;
|
||||
for (i = 0; i < expected.length; i++) {
|
||||
test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"from" : function(test) {
|
||||
test.expect(30);
|
||||
moment.lang('zh-tw');
|
||||
var start = moment([2007, 1, 28]);
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:44}), true), "幾秒", "44 seconds = a few seconds");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:45}), true), "一分鐘", "45 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:89}), true), "一分鐘", "89 seconds = a minute");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({s:90}), true), "2分鐘", "90 seconds = 2 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:44}), true), "44分鐘", "44 minutes = 44 minutes");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:45}), true), "一小時", "45 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:89}), true), "一小時", "89 minutes = an hour");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({m:90}), true), "2小時", "90 minutes = 2 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:5}), true), "5小時", "5 hours = 5 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:21}), true), "21小時", "21 hours = 21 hours");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:22}), true), "一天", "22 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:35}), true), "一天", "35 hours = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({h:36}), true), "2天", "36 hours = 2 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:1}), true), "一天", "1 day = a day");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:5}), true), "5天", "5 days = 5 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:25}), true), "25天", "25 days = 25 days");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:26}), true), "一個月", "26 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:30}), true), "一個月", "30 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:45}), true), "一個月", "45 days = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:46}), true), "2個月", "46 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:74}), true), "2個月", "75 days = 2 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:76}), true), "3個月", "76 days = 3 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:1}), true), "一個月", "1 month = a month");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({M:5}), true), "5個月", "5 months = 5 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:344}), true), "11個月", "344 days = 11 months");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:345}), true), "一年", "345 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:547}), true), "一年", "547 days = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({d:548}), true), "2年", "548 days = 2 years");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:1}), true), "一年", "1 year = a year");
|
||||
test.equal(start.from(moment([2007, 1, 28]).add({y:5}), true), "5年", "5 years = 5 years");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"suffix" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('zh-tw');
|
||||
test.equal(moment(30000).from(0), "幾秒內", "prefix");
|
||||
test.equal(moment(0).from(30000), "幾秒前", "suffix");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"now from now" : function(test) {
|
||||
test.expect(1);
|
||||
moment.lang('zh-tw');
|
||||
test.equal(moment().fromNow(), "幾秒前", "now from now should display as in the past");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"fromNow" : function(test) {
|
||||
test.expect(2);
|
||||
moment.lang('zh-tw');
|
||||
test.equal(moment().add({s:30}).fromNow(), "幾秒內", "in a few seconds");
|
||||
test.equal(moment().add({d:5}).fromNow(), "5天內", "in 5 days");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar day" : function(test) {
|
||||
test.expect(6);
|
||||
moment.lang('zh-tw');
|
||||
|
||||
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");
|
||||
test.equal(moment(a).add({ d: 1 }).calendar(), "明天早上2點00", "tomorrow at the same time");
|
||||
test.equal(moment(a).subtract({ h: 1 }).calendar(), "今天早上1點00", "Now minus 1 hour");
|
||||
test.equal(moment(a).subtract({ d: 1 }).calendar(), "昨天早上2點00", "yesterday at the same time");
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar next week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('zh-tw');
|
||||
|
||||
var i;
|
||||
var m;
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().add({ d: i });
|
||||
test.equal(m.calendar(), m.format('[下]ddddLT'), "Today + " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[下]ddddLT'), "Today + " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[下]ddddLT'), "Today + " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar last week" : function(test) {
|
||||
test.expect(15);
|
||||
moment.lang('zh-tw');
|
||||
|
||||
for (i = 2; i < 7; i++) {
|
||||
m = moment().subtract({ d: i });
|
||||
test.equal(m.calendar(), m.format('[上]ddddLT'), "Today - " + i + " days current time");
|
||||
m.hours(0).minutes(0).seconds(0).milliseconds(0);
|
||||
test.equal(m.calendar(), m.format('[上]ddddLT'), "Today - " + i + " days beginning of day");
|
||||
m.hours(23).minutes(59).seconds(59).milliseconds(999);
|
||||
test.equal(m.calendar(), m.format('[上]ddddLT'), "Today - " + i + " days end of day");
|
||||
}
|
||||
test.done();
|
||||
},
|
||||
|
||||
"calendar all else" : function(test) {
|
||||
test.expect(4);
|
||||
moment.lang('zh-tw');
|
||||
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();
|
||||
},
|
||||
|
||||
"meridiem" : function(test) {
|
||||
test.expect(10);
|
||||
moment.lang('zh-cn');
|
||||
|
||||
test.equal(moment([2011, 2, 23, 0, 0]).format('a'), "早上", "morning");
|
||||
test.equal(moment([2011, 2, 23, 9, 0]).format('a'), "上午", "before noon");
|
||||
test.equal(moment([2011, 2, 23, 12, 0]).format('a'), "中午", "noon");
|
||||
test.equal(moment([2011, 2, 23, 13, 0]).format('a'), "下午", "after noon");
|
||||
test.equal(moment([2011, 2, 23, 18, 0]).format('a'), "晚上", "night");
|
||||
|
||||
test.equal(moment([2011, 2, 23, 0, 0]).format('A'), "早上", "morning");
|
||||
test.equal(moment([2011, 2, 23, 9, 0]).format('A'), "上午", "before noon");
|
||||
test.equal(moment([2011, 2, 23, 12, 0]).format('A'), "中午", "noon");
|
||||
test.equal(moment([2011, 2, 23, 13, 0]).format('A'), "下午", "afternoon");
|
||||
test.equal(moment([2011, 2, 23, 18, 0]).format('A'), "晚上", "night");
|
||||
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user