From: Kruy Vanna Date: Mon, 24 Mar 2014 10:48:52 +0000 (+0900) Subject: fix ordinal X-Git-Tag: 2.6.0~4^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c03596b3bfcb594c3b34c096a9cf56ceac14f5f4;p=thirdparty%2Fmoment.git fix ordinal --- diff --git a/lang/km.js b/lang/km.js index 8bf0eae32..e2b1971bc 100644 --- a/lang/km.js +++ b/lang/km.js @@ -47,14 +47,6 @@ y: "មួយឆ្នាំ", yy: "%d ឆ្នាំ" }, - ordinal: function (number) { - var b = number % 10, - output = (~~(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - }, week: { dow: 1, // Monday is the first day of the week. doy: 4 // The week that contains Jan 4th is the first week of the year. diff --git a/test/lang/km.js b/test/lang/km.js index 3411c4014..2015d30d9 100644 --- a/test/lang/km.js +++ b/test/lang/km.js @@ -41,20 +41,20 @@ exports["lang:km"] = { "format": function (test) { test.expect(22); var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'អាទិត្យ, កុម្ភៈ 14th 2010, 3:25:50 pm'], + ['dddd, MMMM Do YYYY, h:mm:ss a', 'អាទិត្យ, កុម្ភៈ 14 2010, 3:25:50 pm'], ['ddd, hA', 'អាទិត្យ, 3PM'], - ['M Mo MM MMMM MMM', '2 2nd 02 កុម្ភៈ កុម្ភៈ'], + ['M Mo MM MMMM MMM', '2 2 02 កុម្ភៈ កុម្ភៈ'], ['YYYY YY', '2010 10'], - ['D Do DD', '14 14th 14'], - ['d do dddd ddd dd', '0 0th អាទិត្យ អាទិត្យ អាទិត្យ'], - ['DDD DDDo DDDD', '45 45th 045'], - ['w wo ww', '6 6th 06'], + ['D Do DD', '14 14 14'], + ['d do dddd ddd dd', '0 0 អាទិត្យ អាទិត្យ អាទិត្យ'], + ['DDD DDDo DDDD', '45 45 045'], + ['w wo ww', '6 6 06'], ['h hh', '3 03'], ['H HH', '15 15'], ['m mm', '25 25'], ['s ss', '50 50'], ['a A', 'pm PM'], - ['[the] DDDo [day of the year]', 'the 45th day of the year'], + ['[the] DDDo [day of the year]', 'the 45 day of the year'], ['L', '14/02/2010'], ['LL', '14 កុម្ភៈ 2010'], ['LLL', '14 កុម្ភៈ 2010 15:25'], @@ -72,45 +72,6 @@ exports["lang:km"] = { test.done(); }, - "format ordinal": function (test) { - test.expect(31); - 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); var expected = 'មករា មករា_កុម្ភៈ កុម្ភៈ_មិនា មិនា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split("_"), @@ -431,11 +392,11 @@ exports["lang:km"] = { "weeks year starting sunday formatted": function (test) { test.expect(5); - test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', "Jan 1 2012 should be week 52"); - test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', "Jan 2 2012 should be week 1"); - test.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1st', "Jan 8 2012 should be week 1"); - test.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2nd', "Jan 9 2012 should be week 2"); - test.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2nd', "Jan 15 2012 should be week 2"); + test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', "Jan 1 2012 should be week 52"); + test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', "Jan 2 2012 should be week 1"); + test.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', "Jan 8 2012 should be week 1"); + test.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', "Jan 9 2012 should be week 2"); + test.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', "Jan 15 2012 should be week 2"); test.done(); },