Skip to content

Commit eb833f1

Browse files
authored
Merge pull request #21 from Visual-Regression-Tracker/44-dateformat
44 dateformat
2 parents 65f0b11 + c0ffa96 commit eb833f1

File tree

7 files changed

+42
-6
lines changed

7 files changed

+42
-6
lines changed

src/_helpers/format.helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const formatDateTime = (date: string) => new Date(date).toLocaleString();

src/components/BuildList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
} from "../contexts";
2323
import { BuildStatusChip } from "./BuildStatusChip";
2424
import { SkeletonList } from "./SkeletonList";
25+
import { formatDateTime } from "../_helpers/format.helper";
2526

2627
const useStyles = makeStyles((theme: Theme) =>
2728
createStyles({
@@ -75,7 +76,7 @@ const BuildList: FunctionComponent = () => {
7576
<Grid container direction="column">
7677
<Grid item>
7778
<Typography variant="caption" color="textPrimary">
78-
{build.createdAt}
79+
{formatDateTime(build.createdAt)}
7980
</Typography>
8081
</Grid>
8182
<Grid item>

src/components/DateFormated.tsx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from "react";
2+
import {
3+
Button,
4+
Popper,
5+
Fade,
6+
Paper,
7+
makeStyles,
8+
TextField,
9+
Badge,
10+
IconButton,
11+
} from "@material-ui/core";
12+
import {
13+
usePopupState,
14+
bindToggle,
15+
bindPopper,
16+
} from "material-ui-popup-state/hooks";
17+
import { Comment } from "@material-ui/icons";
18+
19+
interface IProps {
20+
text: string | undefined;
21+
}
22+
23+
export const DateFormatted: React.FunctionComponent<IProps> = ({
24+
text,
25+
}) => {
26+
27+
return (
28+
<React.Fragment>
29+
30+
</React.Fragment>
31+
);
32+
};

src/pages/ProjectListPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { Link } from "react-router-dom";
2828
import { Delete, Add } from "@material-ui/icons";
2929
import { routes } from "../constants";
30+
import { formatDateTime } from "../_helpers/format.helper";
3031

3132
const ProjectsListPage = () => {
3233
const theme = useTheme();
@@ -115,7 +116,7 @@ const ProjectsListPage = () => {
115116
<CardContent>
116117
<Typography>Key: {project.id}</Typography>
117118
<Typography>Name: {project.name}</Typography>
118-
<Typography>Updated: {project.updatedAt}</Typography>
119+
<Typography>Created: {formatDateTime(project.createdAt)}</Typography>
119120
</CardContent>
120121
<CardActions>
121122
<Button

src/types/baseline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface Baseline {
55
baselineName: string;
66
testRunId: string;
77
testVariationId: string;
8-
createdAt: Date;
9-
updatedAt: Date;
8+
createdAt: string;
9+
updatedAt: string;
1010
testRun: TestRun;
1111
}

src/types/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface Build {
66
projectName: string;
77
branchName: string;
88
status: BuildStatus;
9-
createdAt: Date;
9+
createdAt: string;
1010
createdBy: string;
1111
testRuns: TestRun[];
1212

src/types/project.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export interface Project {
44
id: string;
55
name: string;
66
builds: Build[];
7-
updatedAt: Date;
7+
updatedAt: string;
8+
createdAt: string;
89
}

0 commit comments

Comments
 (0)