-
+
@@ -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),
};