From 2634e8f18211efec33a67994be5edacfd786bfd8 Mon Sep 17 00:00:00 2001 From: Dmitriy Shekhovtsov Date: Tue, 24 Apr 2018 17:30:06 +0300 Subject: [PATCH] fix(chronos): ro locale updated to momenjs etalon --- src/chronos/i18n/ro.ts | 79 ++++++----- src/chronos/test/locale/ro.spec.ts | 204 +++++++++++++++-------------- 2 files changed, 154 insertions(+), 129 deletions(-) diff --git a/src/chronos/i18n/ro.ts b/src/chronos/i18n/ro.ts index b4ad07c811..064ce0a6f7 100644 --- a/src/chronos/i18n/ro.ts +++ b/src/chronos/i18n/ro.ts @@ -6,51 +6,70 @@ import { LocaleData } from '../locale/locale.class'; // ! moment.js locale configuration // ! locale : Romanian [ro] +//! author : Vlad Gurdiga : https://github.com/gurdiga +//! author : Valentin Agachi : https://github.com/avaly // ! author : Earle white: https://github.com/5earle +function relativeTimeWithPlural(num, withoutSuffix, key) { + let format = { + ss: 'secunde', + mm: 'minute', + hh: 'ore', + dd: 'zile', + MM: 'luni', + yy: 'ani' + }; + + let separator = ' '; + if (num % 100 >= 20 || (num >= 100 && num % 100 === 0)) { + separator = ' de '; + } + return num + separator + format[key]; +} + + export const roLocale: LocaleData = { abbr: 'ro', - months: 'Ianuarie_Februarie_Martie_Aprilie_Mai_Iunie_Iulie_August_Septembrie_Octombrie_Noiembrie_Decembrie'.split('_'), - monthsShort: 'Ian_Feb_Mar_Apr_Mai_Iun_Iul_Aug_Sep_Oct_Noi_Dec'.split('_'), - weekdays: 'Duminica_Luni_Marti_Miercuri_Joi_Vineri_Sambata'.split('_'), - weekdaysShort: 'Dum_Lun_Mar_Mie_Jo_Vin_Sam'.split('_'), - weekdaysMin: 'Du_lu_Ma_Mi_Jo_Vi_Sa'.split('_'), + months: 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'), + monthsShort: 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'), + monthsParseExact: true, + weekdays: 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'), + weekdaysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'), + weekdaysMin: 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'), longDateFormat: { - LT: 'HH:mm', - LTS: 'HH:mm:ss', - L: 'DD/MM/YYYY', + LT: 'H:mm', + LTS: 'H:mm:ss', + L: 'DD.MM.YYYY', LL: 'D MMMM YYYY', - LLL: 'D MMMM YYYY HH:mm', - LLLL: 'dddd D MMMM YYYY HH:mm' + LLL: 'D MMMM YYYY H:mm', + LLLL: 'dddd, D MMMM YYYY H:mm' }, - calendar : { - sameDay: '[Astazi la] LT', - nextDay: '[Maine la] LT', + calendar: { + sameDay: '[azi la] LT', + nextDay: '[mâine la] LT', nextWeek: 'dddd [la] LT', - lastDay: '[Leri la] LT', - lastWeek: '[ultimul] dddd [la] LT', + lastDay: '[ieri la] LT', + lastWeek: '[fosta] dddd [la] LT', sameElse: 'L' }, relativeTime: { - future: 'despre %s', - past: 'există %s', + future: 'peste %s', + past: '%s în urmă', s: 'câteva secunde', - ss: '%d secunde', + ss: relativeTimeWithPlural, m: 'un minut', - mm: '%d minute', - h: 'o ora', - hh: '%d ore', - d: 'intr-o zi', - dd: '%d zi', - M: 'o luna', - MM: '%d luni', + mm: relativeTimeWithPlural, + h: 'o oră', + hh: relativeTimeWithPlural, + d: 'o zi', + dd: relativeTimeWithPlural, + M: 'o lună', + MM: relativeTimeWithPlural, y: 'un an', - yy: 'ani' + yy: relativeTimeWithPlural }, - dayOfMonthOrdinalParse: /\d{1,2}\./, - ordinal: '%d', week: { - dow: 1, - doy: 4 + dow: 1, // Monday is the first day of the week. + doy: 7 // The week that contains Jan 1st is the first week of the year. } }; diff --git a/src/chronos/test/locale/ro.spec.ts b/src/chronos/test/locale/ro.spec.ts index 0f23777246..86a28f4127 100644 --- a/src/chronos/test/locale/ro.spec.ts +++ b/src/chronos/test/locale/ro.spec.ts @@ -17,51 +17,51 @@ describe('locale: ro', () => { it('parse', function () { var i, - _tests = 'Ianuarie Ian_Februarie Feb_Martie Mar_Aprilie Apr_Mai Ma_Iunie Iun_Iulie Iul_August Aug_Septembrie Sep_Octombrie Oct_Noiembrie Noi_Decembrie Dec'.split('_'); + _tests = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie dec.'.split('_'); - function equalTest(input, mmm, i) { + function equalit(input, mmm, i) { assert.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1)); } let tests: string[][] = []; 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); + equalit(tests[i][0], 'MMM', i); + equalit(tests[i][1], 'MMM', i); + equalit(tests[i][0], 'MMMM', i); + equalit(tests[i][1], 'MMMM', i); + equalit(tests[i][0].toLocaleLowerCase(), 'MMMM', i); + equalit(tests[i][1].toLocaleLowerCase(), 'MMMM', i); + equalit(tests[i][0].toLocaleUpperCase(), 'MMMM', i); + equalit(tests[i][1].toLocaleUpperCase(), 'MMMM', i); } }); it('format', function () { var a = [ - ['dddd, MMMM Do YYYY, h:mm:ss a', 'Duminica, 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 Duminica Dum Du'], - ['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 [zi a anului]', 'the 45 zi a anului'], - ['LTS', '15:25:50'], - ['L', '14/02/2010'], - ['LL', '14 Februarie 2010'], - ['LLL', '14 Februarie 2010 15:25'], - ['LLLL', 'Duminica 14 Februarie 2010 15:25'], - ['l', '14/2/2010'], - ['ll', '14 Feb 2010'], - ['lll', '14 Feb 2010 15:25'], - ['llll', 'Dum 14 Feb 2010 15:25'] + ['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 febr.'], + ['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', '7 7 07'], + ['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'], + ['LTS', '15:25:50'], + ['L', '14.02.2010'], + ['LL', '14 februarie 2010'], + ['LLL', '14 februarie 2010 15:25'], + ['LLLL', 'duminică, 14 februarie 2010 15:25'], + ['l', '14.2.2010'], + ['ll', '14 febr. 2010'], + ['lll', '14 febr. 2010 15:25'], + ['llll', 'Dum, 14 febr. 2010 15:25'] ], b = moment(new Date(2010, 1, 14, 15, 25, 50, 125)), i; @@ -109,122 +109,128 @@ describe('locale: ro', () => { }); it('format month', function () { - 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('_'), - i; + var expected = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie dec.'.split('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]); } }); it('format week', function () { - let i, - expected = 'Duminica Dum Du_Luni Lun lu_Marti Mar Ma_Miercuri Mie Mi_Joi Jo Jo_Vineri Vin Vi_Sambata Sam Sa'.split('_'); + 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('_'), i; for (i = 0; i < expected.length; i++) { assert.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]); } }); it('from', function () { - const start = moment([2007, 1, 28]); - assert.equal(start.from(moment([2007, 1, 28]).add({ s: 44 }), true), 'câteva secunde', '44 seconds = câteva secunde'); - assert.equal(start.from(moment([2007, 1, 28]).add({ s: 45 }), true), 'un minut', '45 seconds = un minut'); - assert.equal(start.from(moment([2007, 1, 28]).add({ s: 89 }), true), 'un minut', '89 seconds = un minut'); - assert.equal(start.from(moment([2007, 1, 28]).add({ s: 90 }), true), '2 minute', '90 seconds = 2 minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({ m: 44 }), true), '44 minute', '44 minutes = 44 minute'); - assert.equal(start.from(moment([2007, 1, 28]).add({ m: 45 }), true), 'o ora', '45 minutes = o ora'); - assert.equal(start.from(moment([2007, 1, 28]).add({ m: 89 }), true), 'o ora', '89 minutes = o ora'); - assert.equal(start.from(moment([2007, 1, 28]).add({ m: 90 }), true), '2 ore', '90 minutes = 2 ore'); - assert.equal(start.from(moment([2007, 1, 28]).add({ h: 5 }), true), '5 ore', '5 hours = 5 ore'); - assert.equal(start.from(moment([2007, 1, 28]).add({ h: 21 }), true), '21 ore', '21 ore = 21 ore'); - assert.equal(start.from(moment([2007, 1, 28]).add({ h: 22 }), true), 'intr-o zi', '22 ore = intr-o zi'); - assert.equal(start.from(moment([2007, 1, 28]).add({ h: 35 }), true), 'intr-o zi', '35 ore = intr-o zi'); - assert.equal(start.from(moment([2007, 1, 28]).add({ h: 36 }), true), '2 zi', '36 ore = 2 zi'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 1 }), true), 'intr-o zi', '1 zi = intr-o zi'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 5 }), true), '5 zi', '5 zi = 5 zi'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 25 }), true), '25 zi', '25 zi = 25 zi'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 26 }), true), 'o luna', '26 zi = o luna'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 30 }), true), 'o luna', '30 zi = o luna'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 43 }), true), 'o luna', '43 zi = o luna'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 46 }), true), '2 luni', '46 zi = 2 luni'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 74 }), true), '2 luni', '75 zi = 2 luni'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 76 }), true), '3 luni', '76 zi = 3 luni'); - assert.equal(start.from(moment([2007, 1, 28]).add({ M: 1 }), true), 'o luna', '1 lună = o luna'); - assert.equal(start.from(moment([2007, 1, 28]).add({ M: 5 }), true), '5 luni', '5 luni = 5 luni'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 345 }), true), 'un an', '345 zi = un an'); - assert.equal(start.from(moment([2007, 1, 28]).add({ d: 548 }), true), 'ani', '548 zi = 2 an'); - assert.equal(start.from(moment([2007, 1, 28]).add({ y: 1 }), true), 'un an', '1 year = un an'); - assert.equal(start.from(moment([2007, 1, 28]).add({ y: 5 }), true), 'ani', '5 years = 5 ani'); + var start = moment([2007, 1, 28]); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), 'câteva secunde', '44 seconds = a few seconds'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), 'un minut', '45 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 89}), true), 'un minut', '89 seconds = a minute'); + assert.equal(start.from(moment([2007, 1, 28]).add({s: 90}), true), '2 minute', '90 seconds = 2 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 44}), true), '44 de minute', '44 minutes = 44 minutes'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 45}), true), 'o oră', '45 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 89}), true), 'o oră', '89 minutes = an hour'); + assert.equal(start.from(moment([2007, 1, 28]).add({m: 90}), true), '2 ore', '90 minutes = 2 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 5}), true), '5 ore', '5 hours = 5 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 21}), true), '21 de ore', '21 hours = 21 hours'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 22}), true), 'o zi', '22 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 35}), true), 'o zi', '35 hours = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({h: 36}), true), '2 zile', '36 hours = 2 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 1}), true), 'o zi', '1 day = a day'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 5}), true), '5 zile', '5 days = 5 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), '25 de zile', '25 days = 25 days'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), 'o lună', '26 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), 'o lună', '30 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), 'o lună', '43 days = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), '2 luni', '46 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), '2 luni', '75 days = 2 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), '3 luni', '76 days = 3 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), 'o lună', '1 month = a month'); + assert.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), '5 luni', '5 months = 5 months'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'un an', '345 days = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), '2 ani', '548 days = 2 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), 'un an', '1 year = a year'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), '5 ani', '5 years = 5 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 19}), true), '19 ani', '19 years = 19 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 20}), true), '20 de ani', '20 years = 20 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 100}), true), '100 de ani', '100 years = 100 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 101}), true), '101 ani', '101 years = 101 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 119}), true), '119 ani', '119 years = 119 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 120}), true), '120 de ani', '120 years = 120 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 219}), true), '219 ani', '219 years = 219 years'); + assert.equal(start.from(moment([2007, 1, 28]).add({y: 220}), true), '220 de ani', '220 years = 220 years'); }); it('suffix', function () { - assert.equal(moment(30000).from(0), 'despre câteva secunde', 'prefix'); - assert.equal(moment(0).from(30000), 'există câteva secunde', 'suffix'); + assert.equal(moment(30000).from(0), 'peste câteva secunde', 'prefix'); + assert.equal(moment(0).from(30000), 'câteva secunde în urmă', 'suffix'); }); it('now from now', function () { - assert.equal(moment().fromNow(), 'există câteva secunde', 'now from now should display as in the past'); + assert.equal(moment().fromNow(), 'câteva secunde în urmă', 'now from now should display as in the past'); }); it('fromNow', function () { - assert.equal(moment().add({ s: 30 }).fromNow(), 'despre câteva secunde', 'despre câteva secunde'); - assert.equal(moment().add({ d: 5 }).fromNow(), 'despre 5 zi', '5 zi'); + assert.equal(moment().add({s: 30}).fromNow(), 'peste câteva secunde', 'in a few seconds'); + assert.equal(moment().add({d: 5}).fromNow(), 'peste 5 zile', 'in 5 days'); }); it('calendar day', function () { - const a = moment().hours(12).minutes(0).seconds(0); + var a = moment().hours(12).minutes(0).seconds(0); - assert.equal(moment(a).calendar(), 'Astazi la 12:00', 'Today at 12:00'); - assert.equal(moment(a).add({ m: 25 }).calendar(), 'Astazi la 12:25', 'Now plus 25 min'); - assert.equal(moment(a).add({ h: 1 }).calendar(), 'Astazi la 13:00', 'Now plus 1 hour'); - assert.equal(moment(a).add({ d: 1 }).calendar(), 'Maine la 12:00', 'tomorrow at the same time'); - assert.equal(moment(a).subtract({ h: 1 }).calendar(), 'Astazi la 11:00', 'Now minus 1 hour'); - assert.equal(moment(a).subtract({ d: 1 }).calendar(), 'Leri la 12:00', 'yesterday at the same time'); + assert.equal(moment(a).calendar(), 'azi la 12:00', 'today at the same time'); + assert.equal(moment(a).add({m: 25}).calendar(), 'azi la 12:25', 'Now plus 25 min'); + assert.equal(moment(a).add({h: 1}).calendar(), 'azi la 13:00', 'Now plus 1 hour'); + assert.equal(moment(a).add({d: 1}).calendar(), 'mâine la 12:00', 'tomorrow at the same time'); + assert.equal(moment(a).subtract({h: 1}).calendar(), 'azi la 11:00', 'Now minus 1 hour'); + assert.equal(moment(a).subtract({d: 1}).calendar(), 'ieri la 12:00', 'yesterday at the same time'); }); it('calendar next week', function () { var i, m; for (i = 2; i < 7; i++) { - m = moment().add({ d: i }); - assert.equal(m.calendar(), m.format('dddd [la] LT'), ' Today + ' + i + ' days current time'); + m = moment().add({d: i}); + assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('dddd [la] LT'), ' Today + ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('dddd [la] LT'), 'Today + ' + i + ' days end of day'); } }); it('calendar last week', function () { var i, m; for (i = 2; i < 7; i++) { - m = moment().subtract({ d: i }); - assert.equal(m.calendar(), m.format('[ultimul] dddd [la] LT'), 'Today - ' + i + ' days current time'); + m = moment().subtract({d: i}); + assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days current time'); m.hours(0).minutes(0).seconds(0).milliseconds(0); - assert.equal(m.calendar(), m.format('[ultimul] dddd [la] LT'), 'Today - ' + i + ' days beginning of day'); + assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days beginning of day'); m.hours(23).minutes(59).seconds(59).milliseconds(999); - assert.equal(m.calendar(), m.format('[ultimul] dddd [la] LT'), 'Today - ' + i + ' days end of day'); + assert.equal(m.calendar(), m.format('[fosta] dddd [la] LT'), 'Today - ' + i + ' days end of day'); } }); it('calendar all else', function () { - var weeksAgo = moment().subtract({ w: 1 }), - weeksFromNow = moment().add({ w: 1 }); + var weeksAgo = moment().subtract({w: 1}), + weeksFromNow = moment().add({w: 1}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 1 week'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '1 week ago'); + assert.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}); - assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); - assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); + assert.equal(weeksAgo.calendar(), weeksAgo.format('L'), '2 weeks ago'); + assert.equal(weeksFromNow.calendar(), weeksFromNow.format('L'), 'in 2 weeks'); }); it('weeks year starting sunday formatted', function () { - assert.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', 'Jan 1 2012 should be week 52'); - assert.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', 'Jan 2 2012 should be week 1'); - assert.equal(moment([2012, 0, 8]).format('w ww wo'), '1 01 1', 'Jan 8 2012 should be week 1'); - assert.equal(moment([2012, 0, 9]).format('w ww wo'), '2 02 2', 'Jan 9 2012 should be week 2'); - assert.equal(moment([2012, 0, 15]).format('w ww wo'), '2 02 2', 'Jan 15 2012 should be week 2'); + assert.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', 'Dec 26 2011 should be week 1'); + assert.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', 'Jan 1 2012 should be week 1'); + assert.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', 'Jan 2 2012 should be week 2'); + assert.equal(moment([2012, 0, 8]).format('w ww wo'), '2 02 2', 'Jan 8 2012 should be week 2'); + assert.equal(moment([2012, 0, 9]).format('w ww wo'), '3 03 3', 'Jan 9 2012 should be week 3'); }); });