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.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();
},
}
for (i = 2; i < 7; i++) {
- m = moment().add({ d: 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");
}
for (i = 2; i < 7; i++) {
- m = moment().subtract({ d: 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");
"calendar all else" : function (test) {
test.expect(4);
- var weeksAgo = moment().subtract({ w: 1 }),
- weeksFromNow = moment().add({ w: 1 });
+ var weeksAgo = moment().subtract({w: 1}),
+ 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 });
+ 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");