From 35f43e888610cdfb1493012386944edee052205c Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Tue, 13 Oct 2020 11:29:53 +0200 Subject: [PATCH] chore: update date-fns --- client/package-lock.json | 6 +++--- client/package.json | 2 +- client/src/client-only-routes/ShowCertification.js | 10 +++++----- client/src/components/profile/components/HeatMap.js | 8 ++++---- client/src/components/profile/components/TimeLine.js | 7 ++++--- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/client/package-lock.json b/client/package-lock.json index ad3756210a..21f6775b12 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -9049,9 +9049,9 @@ } }, "date-fns": { - "version": "1.30.1", - "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", - "integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.16.1.tgz", + "integrity": "sha512-sAJVKx/FqrLYHAQeN7VpJrPhagZc9R4ImZIWYRFZaaohR3KzmuK88touwsSwSVT8Qcbd4zoDsnGfX4GFB4imyQ==" }, "debug": { "version": "2.6.9", diff --git a/client/package.json b/client/package.json index 1fd4ef6728..c2a0b47031 100644 --- a/client/package.json +++ b/client/package.json @@ -27,7 +27,7 @@ "browser-cookies": "^1.2.0", "chai": "^4.2.0", "csrf": "^3.1.0", - "date-fns": "^1.30.1", + "date-fns": "^2.16.1", "entities": "^1.1.2", "enzyme": "^3.10.0", "enzyme-adapter-react-16": "^1.15.5", diff --git a/client/src/client-only-routes/ShowCertification.js b/client/src/client-only-routes/ShowCertification.js index f2b2cd03bf..aa861a912f 100644 --- a/client/src/client-only-routes/ShowCertification.js +++ b/client/src/client-only-routes/ShowCertification.js @@ -34,7 +34,7 @@ const propTypes = { certName: PropTypes.string, certTitle: PropTypes.string, completionTime: PropTypes.number, - date: PropTypes.string + date: PropTypes.number }), certDashedName: PropTypes.string, certName: PropTypes.string, @@ -193,14 +193,14 @@ class ShowCertification extends Component { } const { - date: issueDate, + date, name: userFullName, username, certTitle, completionTime } = cert; - const certDate = new Date(issueDate); + const certDate = new Date(date); const certYear = certDate.getFullYear(); const certMonth = certDate.getMonth(); const certURL = `https://freecodecamp.org${pathname}`; @@ -282,9 +282,9 @@ class ShowCertification extends Component { -
+
Issued  - {format(certDate, 'MMMM D, YYYY')} + {format(certDate, 'MMMM d, y')}
diff --git a/client/src/components/profile/components/HeatMap.js b/client/src/components/profile/components/HeatMap.js index 6a431f348b..6d356d527a 100644 --- a/client/src/components/profile/components/HeatMap.js +++ b/client/src/components/profile/components/HeatMap.js @@ -3,10 +3,10 @@ import PropTypes from 'prop-types'; import CalendarHeatMap from '@freecodecamp/react-calendar-heatmap'; import { Row } from '@freecodecamp/react-bootstrap'; import ReactTooltip from 'react-tooltip'; -import addDays from 'date-fns/add_days'; -import addMonths from 'date-fns/add_months'; -import startOfDay from 'date-fns/start_of_day'; -import isEqual from 'date-fns/is_equal'; +import addDays from 'date-fns/addDays'; +import addMonths from 'date-fns/addMonths'; +import startOfDay from 'date-fns/startOfDay'; +import isEqual from 'date-fns/isEqual'; import FullWidthRow from '../../helpers/FullWidthRow'; import Spacer from '../../helpers/Spacer'; diff --git a/client/src/components/profile/components/TimeLine.js b/client/src/components/profile/components/TimeLine.js index 7566f859f3..1551c77934 100644 --- a/client/src/components/profile/components/TimeLine.js +++ b/client/src/components/profile/components/TimeLine.js @@ -80,7 +80,8 @@ class TimelineInner extends Component { renderCompletion(completed) { const { idToNameMap, username } = this.props; - const { id, completedDate } = completed; + const { id } = completed; + const completedDate = new Date(completed.completedDate); const { challengeTitle, challengePath, certPath } = idToNameMap.get(id); return ( @@ -99,8 +100,8 @@ class TimelineInner extends Component { )} -