Skip to content

Commit 9c2ba39

Browse files
Fix timestamp bug
1 parent 99beb35 commit 9c2ba39

File tree

3 files changed

+4454
-3421
lines changed

3 files changed

+4454
-3421
lines changed

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@fortawesome/fontawesome-svg-core": "^1.2.28",
7-
"@fortawesome/free-solid-svg-icons": "^5.13.0",
8-
"@fortawesome/react-fontawesome": "^0.1.9",
9-
"@material-ui/core": "^4.9.11",
6+
"@fortawesome/fontawesome-svg-core": "^1.2.36",
7+
"@fortawesome/free-solid-svg-icons": "^5.15.4",
8+
"@fortawesome/react-fontawesome": "^0.1.15",
9+
"@material-ui/core": "^4.12.3",
1010
"@material-ui/icons": "^4.9.1",
11-
"@material-ui/styles": "^4.9.10",
12-
"@testing-library/jest-dom": "^4.2.4",
13-
"@testing-library/react": "^9.5.0",
14-
"@testing-library/user-event": "^7.2.1",
11+
"@material-ui/styles": "^4.11.4",
12+
"@testing-library/jest-dom": "^5.14.1",
13+
"@testing-library/react": "^12.0.0",
14+
"@testing-library/user-event": "^13.2.1",
1515
"axios": "^0.21.1",
16-
"classnames": "^2.2.6",
17-
"date-fns": "^2.13.0",
18-
"react": "^16.13.1",
19-
"react-content-loader": "^5.0.4",
20-
"react-dom": "^16.13.1",
21-
"react-fade-in": "^1.0.0",
16+
"classnames": "^2.3.1",
17+
"date-fns": "^2.23.0",
18+
"react": "^17.0.2",
19+
"react-content-loader": "^6.0.3",
20+
"react-dom": "^17.0.2",
21+
"react-fade-in": "^2.0.1",
2222
"react-lottie": "^1.2.3",
2323
"react-router-dom": "^5.1.2",
24-
"react-scripts": "^3.4.3",
24+
"react-scripts": "^4.0.3",
2525
"react-simple-maps": "^2.0.0",
26-
"react-tooltip": "^4.2.5",
27-
"recharts": "^1.8.5"
26+
"react-tooltip": "^4.2.21",
27+
"recharts": "^2.1.0"
2828
},
2929
"scripts": {
3030
"start": "react-scripts start",

src/components/CovidApp.js

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ const defaultOptions = {
3333
},
3434
};
3535

36-
const months = {
37-
1: 'Jan',
38-
2: 'Feb',
39-
3: 'Mar',
40-
4: 'Apr',
41-
5: 'May',
42-
6: 'Jun',
43-
7: 'Jul',
44-
8: 'Aug',
45-
9: 'Sep',
46-
10: 'Oct',
47-
11: 'Nov',
48-
12: 'Dec',
49-
};
36+
const months = [
37+
'Jan',
38+
'Feb',
39+
'Mar',
40+
'Apr',
41+
'May',
42+
'Jun',
43+
'Jul',
44+
'Aug',
45+
'Sep',
46+
'Oct',
47+
'Nov',
48+
'Dec',
49+
];
5050

5151
class CovidApp extends Component {
5252
constructor(props) {
@@ -145,24 +145,17 @@ class CovidApp extends Component {
145145
try {
146146
const [date, time] = timestamp.split(' ');
147147
const formattedDate = date.split('/');
148-
console.log(time);
149-
return `${formattedDate[0]} ${months[formattedDate[1]]}, ${time.slice(
150-
0,
151-
5
152-
)} IST`;
148+
149+
return `${formattedDate[0]} ${
150+
months[Number(formattedDate[1]) - 1]
151+
}, ${time.slice(0, 5)} IST`;
153152
} catch (err) {}
154153
}
155154

156155
render() {
157156
const { classes, setDarkMode, isDarkMode } = this.props;
158-
const {
159-
mapData,
160-
isLoading,
161-
data,
162-
districtLevel,
163-
expanded,
164-
updates,
165-
} = this.state;
157+
const { mapData, isLoading, data, districtLevel, expanded, updates } =
158+
this.state;
166159

167160
if (isLoading) {
168161
return (

0 commit comments

Comments
 (0)