"format" : function (test) {
var a = [
- ['dddd, Do MMMM YYYY, a h:mm:ss बà¤\9cà¥\87', 'གཟའ་ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:२༢༥:༥༠ ལ་'],
- ['ddd, a h बà¤\9cà¥\87', 'གཟའ་ཉི་མ་, ཉིན་གུང ༣ ལ་'],
+ ['dddd, Do MMMM YYYY, a h:mm:ss ལà¼\8b', 'གཟའ་ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:२༢༥:༥༠ ལ་'],
+ ['ddd, a h ལà¼\8b', 'གཟའ་ཉི་མ་, ཉིན་གུང ༣ ལ་'],
['M Mo MM MMMM MMM', '༢ ༢ ༠༢ ཟླ་བ་གཉིས་པ ཟླ་བ་གཉིས་པ'],
['YYYY YY', '༢༠༡༠ ༡༠'],
['D Do DD', '༡༤ ༡༤ ༡༤'],
- ['d do dddd ddd dd', '༠༠à½\82à½\9fའà¼\8bà½\89ིà¼\8bà½\98à¼\8b à½\82à½\9fའà¼\8bཉི་མ་'],
+ ['d do dddd ddd dd', '༠༠à½\82à½\9fའà¼\8bà½\89ིà¼\8bà½\98à¼\8b à½\89ིà¼\8bà½\98à¼\8b ཉི་མ་'],
['DDD DDDo DDDD', '༤༥ ༤༥ ༠༤༥'],
['w wo ww', '༨ ༨ ༠༨'],
['h hh', '༣ ༠༣'],
['a A', 'ཉིན་གུང ཉིན་གུང'],
['L', '༡༤/༠༢/༢༠༡༠'],
['LL', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠'],
- ['LLL', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥ ལ་'],
- ['LLLL', 'གཟའ་ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥ ལ་'],
+ ['LLL', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'],
+ ['LLLL', 'གཟའ་ཉི་མ་, ༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'],
['l', '༡༤/༢/༢༠༡༠'],
['ll', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠'],
- ['lll', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥ ལ་'],
- ['llll', 'à½\82à½\9fའà¼\8bà½\89ིà¼\8bà½\98à¼\8b, ༡༤ à½\9fླà¼\8bà½\96à¼\8bà½\82à½\89ིསà¼\8bà½\94 ༢༠༡༠, à½\89ིà½\93à¼\8bà½\82ུà½\84 ༣:༢༥ ལà¼\8b']
+ ['lll', '༡༤ ཟླ་བ་གཉིས་པ ༢༠༡༠, ཉིན་གུང ༣:༢༥'],
+ ['llll', 'à½\89ིà¼\8bà½\98à¼\8b, ༡༤ à½\9fླà¼\8bà½\96à¼\8bà½\82à½\89ིསà¼\8bà½\94 ༢༠༡༠, à½\89ིà½\93à¼\8bà½\82ུà½\84 ༣:༢༥']
],
b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
i;
},
"format month" : function (test) {
- var expected = 'ཟླ་བ་དང་པོ ཟླ་བ་དང་པོ._ཟླ་བ་གཉིས་པ ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ ཟླ་བ་བཅུ་གཉིས་པ'.split("_"), i;
+ var expected = 'ཟླ་བ་དང་པོ ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ ཟླ་བ་བཅུ་གཉིས་པ'.split("_"), i;
for (i = 0; i < expected.length; i++) {
test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
}
"from" : function (test) {
var start = moment([2007, 1, 28]);
- test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "à¤\95à¥\81à¤\9b हà¥\80 à¤\95à¥\8dषण", "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), "སà¾\90རà¼\8bà½\98à¼\8b ༡", "90 seconds = 2 minutes");
- test.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), "སà¾\90རà¼\8bà½\98à¼\8b ༤༤", "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), "à½\86ུà¼\8bà½\9aོà½\91à¼\8b ༢", "90 minutes = 2 hours");
- test.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), "à½\86ུà¼\8bà½\9aོà½\91à¼\8b ༥", "5 hours = 5 hours");
- test.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), "à½\86ུà¼\8bà½\9aོà½\91à¼\8b ༢༡", "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), "à½\89ིà½\93à¼\8b ༢", "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), "à½\89ིà½\93à¼\8b ༥", "5 days = 5 days");
- test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "à½\89ིà½\93à¼\8b ༢༥", "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: 43}), true), "ཟླ་བ་ གཅིག", "43 days = a month");
+ test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ལà½\98à¼\8bསà½\84", "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), "༡ སà¾\90རà¼\8bà½\98", "90 seconds = 2 minutes");
+ test.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), "༤༤ སà¾\90རà¼\8bà½\98", "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), "༢ à½\86ུà¼\8bà½\9aོà½\91", "90 minutes = 2 hours");
+ test.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), "༥ à½\86ུà¼\8bà½\9aོà½\91", "5 hours = 5 hours");
+ test.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), "༢༡ à½\86ུà¼\8bà½\9aོà½\91", "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), "༢ à½\89ིà½\93", "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), "༥ à½\89ིà½\93à¼\8b", "5 days = 5 days");
+ test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "༢༥ à½\89ིà½\93", "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: 43}), true), "ཟླ་བ་གཅིག", "43 days = a month");
test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "ཟླ་བ་ ༢", "46 days = 2 months");
- test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "à½\9fླà¼\8bà½\96à¼\8b ༢", "75 days = 2 months");
- test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "à½\9fླà¼\8bà½\96à¼\8b ༣", "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), "à½\9fླà¼\8bà½\96à¼\8b ༥", "5 months = 5 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: 548}), true), "ལོà¼\8b ༢", "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), "ལོà¼\8b ༥", "5 years = 5 years");
+ test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "༢ à½\9fླà¼\8bà½\96", "75 days = 2 months");
+ test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "༣ à½\9fླà¼\8bà½\96", "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), "༥ à½\9fླà¼\8bà½\96", "5 months = 5 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: 548}), true), "༢ ལོ", "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 years = 5 years");
test.done();
},
"suffix" : function (test) {
- test.equal(moment(30000).from(0), "ལམ་སང", "prefix");
+ test.equal(moment(30000).from(0), "ལམ་སང ལ་", "prefix");
test.equal(moment(0).from(30000), "ལམ་སང སྔན་ལ", "suffix");
test.done();
},
"fromNow" : function (test) {
test.equal(moment().add({s: 30}).fromNow(), "ལམ་སང", "ལམ་སང");
- test.equal(moment().add({d: 5}).fromNow(), "à½\89ིà½\93à¼\8bà¤\82 ༥ ལà¼\8b", "à½\89ིà½\93à¼\8bà¤\82 ༥ ལ་");
+ test.equal(moment().add({d: 5}).fromNow(), "༥ à½\89ིà½\93à¼\8b ལà¼\8b", "༥ à½\89ིà½\93à¼\8b ལ་");
test.done();
},
"calendar day" : function (test) {
var a = moment().hours(2).minutes(0).seconds(0);
- test.equal(moment(a).calendar(), "དི་རིང མཚན་མོ ༢:༠༠ ལ་", "today at the same time");
- test.equal(moment(a).add({m: 25}).calendar(), "དི་རིང མཚན་མོ ༢:༢༥ ལ་", "Now plus 25 min");
- test.equal(moment(a).add({h: 3}).calendar(), "དི་རིང ཞོགས་ཀས ༥:༠༠ ལ་", "Now plus 3 hour");
- test.equal(moment(a).add({d: 1}).calendar(), "སང་ཉིན མཚན་མོ ༢:༠༠ ལ་", "tomorrow at the same time");
- test.equal(moment(a).subtract({h: 1}).calendar(), "དི་རིང མཚན་མོ ༡:༠༠ ལ་", "Now minus 1 hour");
- test.equal(moment(a).subtract({d: 1}).calendar(), "ཁ་སང མཚན་མོ २:०० ལ་", "yesterday at the same time");
+ test.equal(moment(a).calendar(), "དི་རིང མཚན་མོ ༢:༠༠", "today at the same time");
+ test.equal(moment(a).add({m: 25}).calendar(), "དི་རིང མཚན་མོ ༢:༢༥", "Now plus 25 min");
+ test.equal(moment(a).add({h: 3}).calendar(), "དི་རིང ཞོགས་ཀས ༥:༠༠", "Now plus 3 hour");
+ test.equal(moment(a).add({d: 1}).calendar(), "སང་ཉིན མཚན་མོ ༢:༠༠་", "tomorrow at the same time");
+ test.equal(moment(a).subtract({h: 1}).calendar(), "དི་རིང མཚན་མོ ༡:༠༠", "Now minus 1 hour");
+ test.equal(moment(a).subtract({d: 1}).calendar(), "ཁ་སང མཚན་མོ २:००", "yesterday at the same time");
test.done();
},
var i, 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");
+ 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");
+ 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.equal(m.calendar(), m.format('[བདུན་ཕྲག་རྗེས་མ ] dddd[,] LT'), "Today + " + i + " days end of day");
}
test.done();
},
for (i = 2; i < 7; i++) {
m = moment().subtract({d: i});
- test.equal(m.calendar(), m.format('[à½\82à½\9eུà½\82à¼\8bལ ] dddd[,] LT'), "Today - " + i + " days current time");
+ test.equal(m.calendar(), m.format('[à½\96à½\91ུà½\93à¼\8bà½\95ྲà½\82à¼\8bà½\98à½\90འà¼\8bà½\98 ] dddd[,] LT'), "Today - " + i + " days current time");
m.hours(0).minutes(0).seconds(0).milliseconds(0);
- test.equal(m.calendar(), m.format('[à½\82à½\9eུà½\82à¼\8bལ ] dddd[,] LT'), "Today - " + i + " days beginning of day");
+ test.equal(m.calendar(), m.format('[à½\96à½\91ུà½\93à¼\8bà½\95ྲà½\82à¼\8bà½\98à½\90འà¼\8bà½\98 ] dddd[,] LT'), "Today - " + i + " days beginning of day");
m.hours(23).minutes(59).seconds(59).milliseconds(999);
- test.equal(m.calendar(), m.format('[à½\82à½\9eུà½\82à¼\8bལ ] dddd[,] LT'), "Today - " + i + " days end of day");
+ test.equal(m.calendar(), m.format('[à½\96à½\91ུà½\93à¼\8bà½\95ྲà½\82à¼\8bà½\98à½\90འà¼\8bà½\98 ] dddd[,] LT'), "Today - " + i + " days end of day");
}
test.done();
},
"weeks year starting sunday formatted" : function (test) {
test.equal(moment([2012, 0, 1]).format('w ww wo'), '༡ ༠༡ ༡', "Jan 1 2012 should be week 1");
test.equal(moment([2012, 0, 7]).format('w ww wo'), '༡ ༠༡ ༡', "Jan 7 2012 should be week 1");
- test.equal(moment([2012, 0, 8]).format('w ww wo'), '༢ ༠༢ ༠༢', "Jan 8 2012 should be week 2");
+ test.equal(moment([2012, 0, 8]).format('w ww wo'), '༢ ༠༢ ༢', "Jan 8 2012 should be week 2");
test.equal(moment([2012, 0, 14]).format('w ww wo'), '༢ ༠༢ ༢', "Jan 14 2012 should be week 2");
- test.equal(moment([2012, 0, 15]).format('w ww wo'), '༣ ༠༣ ༠༣', "Jan 15 2012 should be week 3");
+ test.equal(moment([2012, 0, 15]).format('w ww wo'), '༣ ༠༣ ༣', "Jan 15 2012 should be week 3");
test.done();
},