Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add DataFormater component for activities insted of pure react-moment

Lukasz Szewczyk12fc05b96d9e
diff --git a/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx b/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx
index 6cecc2d070..c32547cefc 100644
--- a/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx
+++ b/saleor/static/dashboard-next/home/components/HomeActivityCard/HomeActivityCard.tsx
@@ -5,8 +5,8 @@ import ListItemText from "@material-ui/core/ListItemText";
import { withStyles } from "@material-ui/core/styles";
import Typography from "@material-ui/core/Typography";
import * as React from "react";
-import Moment from "react-moment";
import CardTitle from "../../../components/CardTitle";
+import DateFormatter from "../../../components/DateFormatter";
import Skeleton from "../../../components/Skeleton";
import i18n from "../../../i18n";
import { renderCollection } from "../../../misc";
@@ -61,11 +61,7 @@ const HomeProductListCard = decorate<HomeProductListCardProps>(
}}
/>
}
- secondary={
- <Moment format="MMM D, YYYY [at] HH:mm ">
- {activity.date}
- </Moment>
- }
+ secondary={<DateFormatter date={activity.date} />}
/>
) : (
<ListItemText className={classes.loadingProducts}>
diff --git a/saleor/static/dashboard-next/home/fixtures.ts b/saleor/static/dashboard-next/home/fixtures.ts
index 49cc5fb291..7c73467556 100644
--- a/saleor/static/dashboard-next/home/fixtures.ts
+++ b/saleor/static/dashboard-next/home/fixtures.ts
@@ -3,7 +3,7 @@ export const shop = (placeholderImage: string) => ({
{
action: "published",
admin: false,
- date: "2018-09-17T13:22:24.376193+00:00",
+ date: "2018-09-10T13:22:24.376193+00:00",
elementName: "Tępa Podkowa",
id: "1",
newElement: "collection",
@@ -12,7 +12,7 @@ export const shop = (placeholderImage: string) => ({
{
action: "published",
admin: false,
- date: "2018-09-18T13:22:24.376193+00:00",
+ date: "2018-10-18T13:22:24.376193+00:00",
elementName: "Porwania",
id: "2",
newElement: "category",