From 89433a273ef6e9f6f14485c8c838e8d1145ea035 Mon Sep 17 00:00:00 2001 From: Mark Owsiak Date: Tue, 13 Feb 2018 15:32:30 -0500 Subject: [PATCH] feat: add en-CA locale --- src/locale/en-CA/_lib/formatDistance/index.js | 91 ++++ src/locale/en-CA/_lib/formatDistance/test.js | 219 ++++++++++ src/locale/en-CA/_lib/formatLong/index.js | 12 + src/locale/en-CA/index.d.ts | 4 + src/locale/en-CA/index.js | 26 ++ src/locale/en-CA/index.js.flow | 37 ++ src/locale/en-CA/test.js | 408 ++++++++++++++++++ 7 files changed, 797 insertions(+) create mode 100644 src/locale/en-CA/_lib/formatDistance/index.js create mode 100644 src/locale/en-CA/_lib/formatDistance/test.js create mode 100644 src/locale/en-CA/_lib/formatLong/index.js create mode 100644 src/locale/en-CA/index.d.ts create mode 100644 src/locale/en-CA/index.js create mode 100644 src/locale/en-CA/index.js.flow create mode 100644 src/locale/en-CA/test.js diff --git a/src/locale/en-CA/_lib/formatDistance/index.js b/src/locale/en-CA/_lib/formatDistance/index.js new file mode 100644 index 0000000000..94b8ca7642 --- /dev/null +++ b/src/locale/en-CA/_lib/formatDistance/index.js @@ -0,0 +1,91 @@ +var formatDistanceLocale = { + lessThanXSeconds: { + one: 'less than a second', + other: 'less than {{count}} seconds' + }, + + xSeconds: { + one: 'a few seconds', + other: '{{count}} seconds' + }, + + halfAMinute: 'half a minute', + + lessThanXMinutes: { + one: 'less than a minute', + other: 'less than {{count}} minutes' + }, + + xMinutes: { + one: 'a minute', + other: '{{count}} minutes' + }, + + aboutXHours: { + one: 'about an hour', + other: 'about {{count}} hours' + }, + + xHours: { + one: 'an hour', + other: '{{count}} hours' + }, + + xDays: { + one: 'a day', + other: '{{count}} days' + }, + + aboutXMonths: { + one: 'about a month', + other: 'about {{count}} months' + }, + + xMonths: { + one: 'a month', + other: '{{count}} months' + }, + + aboutXYears: { + one: 'about a year', + other: 'about {{count}} years' + }, + + xYears: { + one: 'a year', + other: '{{count}} years' + }, + + overXYears: { + one: 'over a year', + other: 'over {{count}} years' + }, + + almostXYears: { + one: 'almost a year', + other: 'almost {{count}} years' + } +} + +export default function formatDistance (token, count, options) { + options = options || {} + + var result + if (typeof formatDistanceLocale[token] === 'string') { + result = formatDistanceLocale[token] + } else if (count === 1) { + result = formatDistanceLocale[token].one + } else { + result = formatDistanceLocale[token].other.replace('{{count}}', count) + } + + if (options.addSuffix) { + if (options.comparison > 0) { + return 'in ' + result + } else { + return result + ' ago' + } + } + + return result +} diff --git a/src/locale/en-CA/_lib/formatDistance/test.js b/src/locale/en-CA/_lib/formatDistance/test.js new file mode 100644 index 0000000000..93301b9172 --- /dev/null +++ b/src/locale/en-CA/_lib/formatDistance/test.js @@ -0,0 +1,219 @@ +// @flow +/* eslint-env mocha */ + +import assert from 'power-assert' +import formatDistance from '.' + +describe('en-CA locale > formatDistance', function () { + describe('lessThanXSeconds', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('lessThanXSeconds', 1) === 'less than a second') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('lessThanXSeconds', 2) === 'less than 2 seconds') + }) + }) + }) + + describe('xSeconds', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xSeconds', 1) === 'a few seconds') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xSeconds', 2) === '2 seconds') + }) + }) + }) + + describe('halfAMinute', function () { + it('returns a proper string', function () { + assert(formatDistance('halfAMinute') === 'half a minute') + }) + + it('ignores the second argument', function () { + assert(formatDistance('halfAMinute', 123) === 'half a minute') + }) + }) + + describe('lessThanXMinutes', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('lessThanXMinutes', 1) === 'less than a minute') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('lessThanXMinutes', 2) === 'less than 2 minutes') + }) + }) + }) + + describe('xMinutes', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xMinutes', 1) === 'a minute') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xMinutes', 2) === '2 minutes') + }) + }) + }) + + describe('aboutXHours', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('aboutXHours', 1) === 'about an hour') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('aboutXHours', 2) === 'about 2 hours') + }) + }) + }) + + describe('xHours', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xHours', 1) === 'an hour') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xHours', 2) === '2 hours') + }) + }) + }) + + describe('xDays', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xDays', 1) === 'a day') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xDays', 2) === '2 days') + }) + }) + }) + + describe('aboutXMonths', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('aboutXMonths', 1) === 'about a month') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('aboutXMonths', 2) === 'about 2 months') + }) + }) + }) + + describe('xMonths', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xMonths', 1) === 'a month') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xMonths', 2) === '2 months') + }) + }) + }) + + describe('aboutXYears', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('aboutXYears', 1) === 'about a year') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('aboutXYears', 2) === 'about 2 years') + }) + }) + }) + + describe('xYears', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xYears', 1) === 'a year') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('xYears', 2) === '2 years') + }) + }) + }) + + describe('overXYears', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('overXYears', 1) === 'over a year') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('overXYears', 2) === 'over 2 years') + }) + }) + }) + + describe('almostXYears', function () { + context('when the count equals 1', function () { + it('returns a proper string', function () { + assert(formatDistance('almostXYears', 1) === 'almost a year') + }) + }) + + context('when the count is more than 1', function () { + it('returns a proper string', function () { + assert(formatDistance('almostXYears', 2) === 'almost 2 years') + }) + }) + }) + + context('with a past suffix', function () { + it('adds `ago` to a string', function () { + var result = formatDistance('aboutXYears', 1, { + addSuffix: true, + comparison: -1 + }) + assert(result === 'about a year ago') + }) + }) + + context('with a future suffix', function () { + it('adds `in` to a string', function () { + var result = formatDistance('halfAMinute', null, { + addSuffix: true, + comparison: 1 + }) + assert(result === 'in half a minute') + }) + }) +}) diff --git a/src/locale/en-CA/_lib/formatLong/index.js b/src/locale/en-CA/_lib/formatLong/index.js new file mode 100644 index 0000000000..dd9bc99aad --- /dev/null +++ b/src/locale/en-CA/_lib/formatLong/index.js @@ -0,0 +1,12 @@ +import buildFormatLongFn from '../../../_lib/buildFormatLongFn/index.js' + +var formatLong = buildFormatLongFn({ + LT: 'h:mm A', + LTS: 'h:mm:ss A', + L: 'YYYY-MM-DD', + LL: 'MMMM D, YYYY', + LLL: 'MMMM D, YYYY h:mm A', + LLLL: 'dddd, MMMM D, YYYY h:mm A' +}) + +export default formatLong diff --git a/src/locale/en-CA/index.d.ts b/src/locale/en-CA/index.d.ts new file mode 100644 index 0000000000..7b00b524f6 --- /dev/null +++ b/src/locale/en-CA/index.d.ts @@ -0,0 +1,4 @@ +// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it. + +import {enUS} from 'date-fns/locale' +export = enUS diff --git a/src/locale/en-CA/index.js b/src/locale/en-CA/index.js new file mode 100644 index 0000000000..77e301c19c --- /dev/null +++ b/src/locale/en-CA/index.js @@ -0,0 +1,26 @@ +import formatDistance from './_lib/formatDistance/index.js' +import formatLong from './_lib/formatLong/index.js' +import formatRelative from '../en-US/_lib/formatRelative/index.js' +import localize from '../en-US/_lib/localize/index.js' +import match from '../en-US/_lib/match/index.js' + +/** + * @type {Locale} + * @category Locales + * @summary English locale (Canada). + * @language English + * @iso-639-2 eng + */ +var locale = { + formatDistance: formatDistance, + formatLong: formatLong, + formatRelative: formatRelative, + localize: localize, + match: match, + options: { + weekStartsOn: 0 /* Sunday */, + firstWeekContainsDate: 1 + } +} + +export default locale diff --git a/src/locale/en-CA/index.js.flow b/src/locale/en-CA/index.js.flow new file mode 100644 index 0000000000..df800ba69c --- /dev/null +++ b/src/locale/en-CA/index.js.flow @@ -0,0 +1,37 @@ +// @flow +// This file is generated automatically by `scripts/build/typings.js`. Please, don't change it. + +type Locale = { + formatDistance: Function, + formatLong: Function, + formatRelative: Function, + localize: { + ordinalNumber: Function, + weekday: Function, + weekdays: Function, + month: Function, + months: Function, + timeOfDay: Function, + timesOfDay: Function + }, + match: { + ordinalNumbers: Function, + ordinalNumber: Function, + weekdays: Function, + weekday: Function, + months: Function, + month: Function, + timesOfDay: Function, + timeOfDay: Function + }, + formatters?: Object, + formattingTokensRegExp?: RegExp, + units?: Object, + parsers?: Object, + parsingTokensRegExp?: RegExp, + options?: { + weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6 + } +} + +declare module.exports: Locale diff --git a/src/locale/en-CA/test.js b/src/locale/en-CA/test.js new file mode 100644 index 0000000000..995263b7a7 --- /dev/null +++ b/src/locale/en-CA/test.js @@ -0,0 +1,408 @@ +// @flow +/* eslint-env mocha */ + +import assert from 'power-assert' +import locale from '.' + +import differenceInCalendarWeeks from '../../differenceInCalendarWeeks' +import endOfWeek from '../../endOfWeek' +import format from '../../format' +import formatDistance from '../../formatDistance' +import formatDistanceStrict from '../../formatDistanceStrict' +import formatRelative from '../../formatRelative' +import isSameWeek from '../../isSameWeek' +import lastDayOfWeek from '../../lastDayOfWeek' +import parse from '../../parse' +import setDay from '../../setDay' +import startOfWeek from '../../startOfWeek' + +describe('en-US locale', function () { + context('with `differenceInCalendarWeeks`', function () { + it('sets the first day of the week', function () { + var result = differenceInCalendarWeeks( + new Date(2014, 5 /* Jun */, 29, 6, 0), + new Date(2014, 6 /* Jul */, 8, 18, 0), + {locale: locale} + ) + assert(result === -1) + }) + }) + + context('with `endOfWeek`', function () { + it('sets the first day of the week', function () { + var date = new Date(2014, 8 /* Sep */, 2, 11, 55, 0) + var result = endOfWeek(date, {locale: locale}) + assert.deepEqual(result, new Date(2014, 8 /* Sep */, 6, 23, 59, 59, 999)) + }) + }) + + context('with `format`', function () { + var date = new Date(1986, 3 /* Apr */, 4, 10, 32, 0, 900) + + describe('months', function () { + it('Mo', function () { + var result = format(date, 'Mo [month]', {locale: locale}) + assert(result === '4th month') + }) + + it('MMM', function () { + var result = format(date, 'MMM', {locale: locale}) + assert(result === 'Apr') + }) + + it('MMMM', function () { + var result = format(date, 'MMMM', {locale: locale}) + assert(result === 'April') + }) + }) + + describe('quarters', function () { + it('Qo', function () { + var result = format(date, 'Qo [quarter]', {locale: locale}) + assert(result === '2nd quarter') + }) + }) + + describe('days of month', function () { + it('Do', function () { + var result = format(date, 'Do MMMM YYYY', {locale: locale}) + assert(result === '4th April 1986') + }) + }) + + describe('days of year', function () { + it('DDDo', function () { + var result = format(new Date(1992, 0 /* Jan */, 1), 'DDDo [day of the year]', {locale: locale}) + assert(result === '1st day of the year') + }) + }) + + describe('days of week', function () { + it('all variants', function () { + var result = format(date, 'do [day of the week,] dd ddd dddd', {locale: locale}) + assert(result === '5th day of the week, Fr Fri Friday') + }) + }) + + describe('ISO weeks', function () { + it('Wo', function () { + var result = format(date, 'Wo [week]', {locale: locale}) + assert(result === '14th week') + }) + }) + + describe('hours and am/pm', function () { + it('am/pm', function () { + var result = format(date, 'hh:mm a', {locale: locale}) + assert(result === '10:32 am') + }) + + it('12 pm', function () { + var date = new Date(1986, 3 /* Apr */, 4, 12, 0, 0, 900) + var result = format(date, 'hh:mm a', {locale: locale}) + assert(result === '12:00 pm') + }) + + it('12 am', function () { + var date = new Date(1986, 3 /* Apr */, 6, 0, 0, 0, 900) + var result = format(date, 'h:mm a', {locale: locale}) + assert(result === '12:00 am') + }) + + it('12 a.m.', function () { + var date = new Date(1986, 3 /* Apr */, 6, 0, 0, 0, 900) + var result = format(date, 'h:mm aa', {locale: locale}) + assert(result === '12:00 a.m.') + }) + + it('12 p.m.', function () { + var date = new Date(1986, 3 /* Apr */, 4, 12, 0, 0, 900) + var result = format(date, 'hh:mm aa', {locale: locale}) + assert(result === '12:00 p.m.') + }) + + it('12PM', function () { + var date = new Date(1986, 3 /* Apr */, 4, 12, 0, 0, 900) + var result = format(date, 'hh:mmA', {locale: locale}) + assert(result === '12:00PM') + }) + }) + + describe('long formats', function () { + it('LT', function () { + var result = format(date, 'LT', {locale: locale}) + assert(result === '10:32 AM') + }) + + it('LTS', function () { + var result = format(date, 'LTS', {locale: locale}) + assert(result === '10:32:00 AM') + }) + + it('L', function () { + var result = format(new Date(2017, 6 /* Jul */, 2), 'L', {locale: locale}) + assert(result === '2017-07-02') + }) + + it('LL', function () { + var result = format(date, 'LL', {locale: locale}) + assert(result === 'April 4, 1986') + }) + + it('LLL', function () { + var result = format(date, 'LLL', {locale: locale}) + assert(result === 'April 4, 1986 10:32 AM') + }) + + it('LLLL', function () { + var result = format(date, 'LLLL', {locale: locale}) + assert(result === 'Friday, April 4, 1986 10:32 AM') + }) + }) + }) + + context('with `formatDistance`', function () { + it('works as expected', function () { + var result = formatDistance( + new Date(1986, 3, 4, 10, 32, 25), + new Date(1986, 3, 4, 10, 32, 0), + {locale: locale, includeSeconds: true} + ) + assert(result === 'half a minute') + }) + + context('when `addSuffix` option is true', function () { + it('adds a future suffix', function () { + var result = formatDistance( + new Date(1986, 3, 4, 10, 32, 7), + new Date(1986, 3, 4, 10, 32, 0), + {locale: locale, includeSeconds: true, addSuffix: true} + ) + assert(result === 'in less than 10 seconds') + }) + + it('adds a past suffix', function () { + var result = formatDistance( + new Date(1986, 3, 4, 10, 32, 0), + new Date(1986, 3, 4, 11, 32, 0), + {locale: locale, addSuffix: true} + ) + assert(result === 'about an hour ago') + }) + }) + }) + + context('with `formatDistanceStrict`', function () { + it('works as expected', function () { + var result = formatDistanceStrict( + new Date(1986, 3, 4, 10, 32, 0), + new Date(1986, 3, 4, 12, 32, 0), + {locale: locale, unit: 'm'} + ) + assert(result === '120 minutes') + }) + + describe('when `addSuffix` option is true', function () { + it('adds a future suffix', function () { + var result = formatDistanceStrict( + new Date(1986, 3, 4, 10, 32, 25), + new Date(1986, 3, 4, 10, 32, 0), + {locale: locale, addSuffix: true} + ) + assert(result === 'in 25 seconds') + }) + + it('adds a past suffix', function () { + var result = formatDistanceStrict( + new Date(1986, 3, 4, 10, 32, 0), + new Date(1986, 3, 4, 11, 32, 0), + {locale: locale, addSuffix: true} + ) + assert(result === 'an hour ago') + }) + }) + }) + + context('with `formatRelative`', function () { + var baseDate = new Date(1986, 3 /* Apr */, 4, 10, 32, 0, 900) + + it('last week', function () { + var result = formatRelative(new Date(1986, 3 /* Apr */, 1), baseDate, {locale: locale}) + assert(result === 'last Tuesday at 12:00 AM') + }) + + it('yesterday', function () { + var result = formatRelative(new Date(1986, 3 /* Apr */, 3, 22, 22), baseDate, {locale: locale}) + assert(result === 'yesterday at 10:22 PM') + }) + + it('today', function () { + var result = formatRelative(new Date(1986, 3 /* Apr */, 4, 16, 50), baseDate, {locale: locale}) + assert(result === 'today at 4:50 PM') + }) + + it('tomorrow', function () { + var result = formatRelative(new Date(1986, 3 /* Apr */, 5, 7, 30), baseDate, {locale: locale}) + assert(result === 'tomorrow at 7:30 AM') + }) + + it('next week', function () { + var result = formatRelative(new Date(1986, 3 /* Apr */, 6, 12, 0), baseDate, {locale: locale}) + assert(result === 'Sunday at 12:00 PM') + }) + + it('after the next week', function () { + var result = formatRelative(new Date(1986, 3 /* Apr */, 11, 16, 50), baseDate, {locale: locale}) + assert(result === '1986-04-11') + }) + }) + + context('with `isSameWeek`', function () { + it('sets the first day of the week', function () { + var result = isSameWeek( + new Date(2014, 7 /* Aug */, 31), + new Date(2014, 8 /* Sep */, 4), + {locale: locale} + ) + assert(result === true) + }) + }) + + context('with `lastDayOfWeek`', function () { + it('sets the first day of the week', function () { + var date = new Date(2014, 8 /* Sep */, 2, 11, 55, 0) + var result = lastDayOfWeek(date, {locale: locale}) + assert.deepEqual(result, new Date(2014, 8 /* Sep */, 6)) + }) + }) + + context('with `parse`', function () { + var baseDate = new Date(1986, 3 /* Apr */, 4, 10, 32, 0, 900) + + it('sets the first day of the week', function () { + var result = parse('0', 'd', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(1986, 2 /* Mar */, 30)) + }) + + describe('quarters', function () { + it('Qo', function () { + var result = parse('2000 2nd', 'YYYY Qo', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2000, 3 /* Apr */, 1)) + }) + }) + + describe('months', function () { + it('Mo', function () { + var result = parse('2014 12th', 'YYYY Mo', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2014, 11 /* Dec */, 1)) + }) + + it('MMM', function () { + var result = parse('2016 Nov', 'YYYY MMM', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 1)) + }) + + it('MMMM', function () { + var result = parse('2016 December', 'YYYY MMMM', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 11 /* Dec */, 1)) + }) + }) + + describe('ISO weeks', function () { + it('Wo', function () { + var result = parse('2016 3rd', 'GGGG Wo', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 0 /* Jan */, 18)) + }) + }) + + describe('days of a week', function () { + it('do', function () { + var result = parse('2016 4 0th', 'GGGG W do', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 0 /* Jan */, 24)) + }) + + it('dd', function () { + var result = parse('2016 4 Mo', 'GGGG W dd', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 0 /* Jan */, 25)) + }) + + it('ddd', function () { + var result = parse('2016 4 Wed', 'GGGG W ddd', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 0 /* Jan */, 27)) + }) + + it('dddd', function () { + var result = parse('2016 4 Friday', 'GGGG W dddd', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 0 /* Jan */, 29)) + }) + }) + + describe('days of a month', function () { + it('Do', function () { + var result = parse('2016 11 15th', 'YYYY MM Do', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 15)) + }) + }) + + describe('days of a year', function () { + it('DDDo', function () { + var result = parse('2016 100th', 'YYYY DDDo', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 3 /* Apr */, 9)) + }) + }) + + describe('a.m./p.m.', function () { + it('AM', function () { + var result = parse('2016-11-25 04 AM', 'YYYY-MM-DD hh A', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 25, 4, 0, 0, 0)) + }) + + it('PM', function () { + var result = parse('2016-11-25 04 PM', 'YYYY-MM-DD hh A', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 25, 16, 0, 0, 0)) + }) + + it('am', function () { + var result = parse('2016-11-25 04 am', 'YYYY-MM-DD hh a', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 25, 4, 0, 0, 0)) + }) + + it('pm', function () { + var result = parse('2016-11-25 04 pm', 'YYYY-MM-DD hh a', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 25, 16, 0, 0, 0)) + }) + + it('a.m.', function () { + var result = parse('2016-11-25 04 a.m.', 'YYYY-MM-DD hh aa', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 25, 4, 0, 0, 0)) + }) + + it('p.m.', function () { + var result = parse('2016-11-25 04 p.m.', 'YYYY-MM-DD hh aa', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(2016, 10 /* Nov */, 25, 16, 0, 0, 0)) + }) + }) + + describe('long formats', function () { + it('unfolds long formats', function () { + var result = parse('April 6, 1987 11:32 AM', 'LLL', baseDate, {locale: locale}) + assert.deepEqual(result, new Date(1987, 3 /* Apr */, 6, 11, 32)) + }) + }) + }) + + context('with `setDay`', function () { + it('sets the first day of the week', function () { + var result = setDay(new Date(2014, 8 /* Sep */, 1), 0, {locale: locale}) + assert.deepEqual(result, new Date(2014, 7 /* Aug */, 31)) + }) + }) + + context('with `startOfWeek`', function () { + it('sets the first day of the week', function () { + var date = new Date(2014, 8 /* Sep */, 2, 11, 55, 0) + var result = startOfWeek(date, {locale: locale}) + assert.deepEqual(result, new Date(2014, 7 /* Aug */, 31)) + }) + }) +})