diff --git a/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap b/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap index fa20fb44..2d84624e 100644 --- a/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap +++ b/src/components/BookingDateRangeFilter/__snapshots__/BookingDateRangeFilter.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`BookingDateRangeFilter matches plain snapshot 1`] = ` - - + `; exports[`BookingDateRangeFilter matches popup snapshot 1`] = ` - - + `; diff --git a/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap b/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap index 833d47d8..7b7bc168 100644 --- a/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap +++ b/src/components/TransactionPanel/__snapshots__/TransactionPanel.test.js.snap @@ -41,7 +41,7 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -83,7 +83,7 @@ exports[`TransactionPanel - Order accepted matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -708,7 +708,7 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i - - - - - - - - - - - - - - - - + - + diff --git a/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap b/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap index 6e22ef14..112093b6 100644 --- a/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap +++ b/src/containers/CheckoutPage/__snapshots__/CheckoutPage.test.js.snap @@ -86,7 +86,7 @@ exports[`CheckoutPage matches snapshot 1`] = `
- - + diff --git a/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap b/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap index dc1bbae2..ac846bd4 100644 --- a/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap +++ b/src/containers/EditListingPage/__snapshots__/EditListingPage.test.js.snap @@ -6,7 +6,7 @@ exports[`EditListingPageComponent matches snapshot 1`] = ` title="EditListingPage.titleCreateListing" > - - + @@ -538,7 +538,7 @@ exports[`InboxPage matches snapshot 3`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -691,7 +691,7 @@ exports[`InboxPage matches snapshot 3`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } @@ -839,7 +839,7 @@ exports[`InboxPage matches snapshot 3`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap b/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap index fba8e759..bf08119a 100644 --- a/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap +++ b/src/containers/LandingPage/__snapshots__/LandingPage.test.js.snap @@ -89,7 +89,7 @@ exports[`LandingPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap index af79abac..aa630737 100644 --- a/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap +++ b/src/containers/ListingPage/__snapshots__/ListingPage.test.js.snap @@ -277,7 +277,7 @@ exports[`ListingPage matches snapshot 1`] = ` title="listing1 title" /> - - + diff --git a/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap b/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap index 23d56ebb..3a0d1375 100644 --- a/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap +++ b/src/containers/ManageListingsPage/__snapshots__/ManageListingsPage.test.js.snap @@ -34,7 +34,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap b/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap index 7e38d3eb..e4faa66e 100644 --- a/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap +++ b/src/containers/NotFoundPage/__snapshots__/NotFoundPage.test.js.snap @@ -36,7 +36,7 @@ exports[`NotFoundPageComponent matches snapshot 1`] = ` values={Object {}} />

- @@ -46,7 +46,7 @@ exports[`NotFoundPageComponent matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap b/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap index 50763f24..69350a45 100644 --- a/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap +++ b/src/containers/PasswordChangePage/__snapshots__/PasswordChangePage.test.js.snap @@ -71,7 +71,7 @@ exports[`PasswordChangePage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap b/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap index 31a6afba..8ded18bb 100644 --- a/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap +++ b/src/containers/PasswordRecoveryPage/__snapshots__/PasswordRecoveryPage.test.js.snap @@ -54,7 +54,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap index 4caa8b6a..d9d5a6e5 100644 --- a/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap +++ b/src/containers/PayoutPreferencesPage/__snapshots__/PayoutPreferencesPage.test.js.snap @@ -49,7 +49,7 @@ exports[`PayoutPreferencesPage matches snapshot with Stripe connected 1`] = ` className={null} rootClassName={null} > - + @@ -98,7 +98,7 @@ exports[`PayoutPreferencesPage matches snapshot with Stripe not connected 1`] = values={Object {}} />

- - + @@ -168,7 +168,7 @@ exports[`PayoutPreferencesPage matches snapshot with details submitted 1`] = ` values={Object {}} />

- - + diff --git a/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap b/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap index 55f1ead5..311ca367 100644 --- a/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap +++ b/src/containers/ProfilePage/__snapshots__/ProfilePage.test.js.snap @@ -118,7 +118,7 @@ exports[`ProfilePage matches snapshot 1`] = ` ] } /> - @@ -128,7 +128,7 @@ exports[`ProfilePage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap b/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap index 01f89d96..5c779d3d 100644 --- a/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap +++ b/src/containers/ProfileSettingsPage/__snapshots__/ProfileSettingsPage.test.js.snap @@ -41,7 +41,7 @@ exports[`ContactDetailsPage matches snapshot 1`] = ` className={null} rootClassName={null} > - + diff --git a/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap b/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap index 6ab1bd50..ad4fca73 100644 --- a/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap +++ b/src/containers/TransactionPage/__snapshots__/TransactionPage.test.js.snap @@ -20,7 +20,7 @@ exports[`TransactionPage - Order matches snapshot 1`] = ` rootClassName={null} >
- - + @@ -244,7 +244,7 @@ exports[`TransactionPage - Sale matches snapshot 1`] = ` rootClassName={null} >
- - + diff --git a/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap b/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap index dc0e85b0..fab92d53 100644 --- a/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap +++ b/src/forms/BookingDatesForm/__snapshots__/BookingDatesForm.test.js.snap @@ -12,7 +12,7 @@ exports[`BookingDatesForm matches snapshot without selected dates 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap b/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap index be2742fc..c420ea48 100644 --- a/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap +++ b/src/forms/EditListingAvailabilityForm/__snapshots__/EditListingAvailabilityForm.test.js.snap @@ -54,7 +54,7 @@ exports[`EditListingAvailabilityForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap b/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap index ef131e56..042fcfb6 100644 --- a/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap +++ b/src/forms/EditListingLocationForm/__snapshots__/EditListingLocationForm.test.js.snap @@ -11,7 +11,7 @@ exports[`EditListingLocationForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap b/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap index 4c0fadb9..029cb95e 100644 --- a/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap +++ b/src/forms/EditListingPhotosForm/__snapshots__/EditListingPhotosForm.test.js.snap @@ -18,7 +18,7 @@ exports[`EditListingPhotosForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap b/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap index 9610a342..6b703bb3 100644 --- a/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap +++ b/src/forms/EditListingPoliciesForm/__snapshots__/EditListingPoliciesForm.test.js.snap @@ -10,7 +10,7 @@ exports[`EditListingPoliciesForm matches snapshot 1`] = ` "formatMessage": [Function], "formatNumber": [Function], "formatPlural": [Function], - "formatRelative": [Function], + "formatRelativeTime": [Function], "formatTime": [Function], "now": [Function], } diff --git a/src/util/dates.js b/src/util/dates.js index 5599df18..36072147 100644 --- a/src/util/dates.js +++ b/src/util/dates.js @@ -166,7 +166,10 @@ export const formatDate = (intl, todayString, d) => { if (!paramsValid) { throw new Error(`Invalid params for formatDate: (${intl}, ${todayString}, ${d})`); } - const now = moment(intl.now()); + + // By default we can use moment() directly but in tests we need to use a specific dates. + // fakeIntl used in tests contains now() function wich returns predefined date + const now = intl.now ? moment(intl.now()) : moment(); const formattedTime = intl.formatTime(d); let formattedDate; diff --git a/src/util/test-data.js b/src/util/test-data.js index 62484c47..0ba077ee 100644 --- a/src/util/test-data.js +++ b/src/util/test-data.js @@ -294,7 +294,7 @@ export const fakeIntl = { formatMessage: msg => msg.id, formatNumber: d => d, formatPlural: d => d, - formatRelative: d => d, + formatRelativeTime: d => d, formatTime: d => `${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`, now: () => Date.UTC(2017, 10, 23, 12, 59), };