chore: update date-fns

This commit is contained in:
Oliver Eyton-Williams
2020-10-13 11:29:53 +02:00
committed by Mrugesh Mohapatra
parent 6da9d105e0
commit 35f43e8886
5 changed files with 17 additions and 16 deletions

View File

@ -9049,9 +9049,9 @@
} }
}, },
"date-fns": { "date-fns": {
"version": "1.30.1", "version": "2.16.1",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-1.30.1.tgz", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.16.1.tgz",
"integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==" "integrity": "sha512-sAJVKx/FqrLYHAQeN7VpJrPhagZc9R4ImZIWYRFZaaohR3KzmuK88touwsSwSVT8Qcbd4zoDsnGfX4GFB4imyQ=="
}, },
"debug": { "debug": {
"version": "2.6.9", "version": "2.6.9",

View File

@ -27,7 +27,7 @@
"browser-cookies": "^1.2.0", "browser-cookies": "^1.2.0",
"chai": "^4.2.0", "chai": "^4.2.0",
"csrf": "^3.1.0", "csrf": "^3.1.0",
"date-fns": "^1.30.1", "date-fns": "^2.16.1",
"entities": "^1.1.2", "entities": "^1.1.2",
"enzyme": "^3.10.0", "enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.5", "enzyme-adapter-react-16": "^1.15.5",

View File

@ -34,7 +34,7 @@ const propTypes = {
certName: PropTypes.string, certName: PropTypes.string,
certTitle: PropTypes.string, certTitle: PropTypes.string,
completionTime: PropTypes.number, completionTime: PropTypes.number,
date: PropTypes.string date: PropTypes.number
}), }),
certDashedName: PropTypes.string, certDashedName: PropTypes.string,
certName: PropTypes.string, certName: PropTypes.string,
@ -193,14 +193,14 @@ class ShowCertification extends Component {
} }
const { const {
date: issueDate, date,
name: userFullName, name: userFullName,
username, username,
certTitle, certTitle,
completionTime completionTime
} = cert; } = cert;
const certDate = new Date(issueDate); const certDate = new Date(date);
const certYear = certDate.getFullYear(); const certYear = certDate.getFullYear();
const certMonth = certDate.getMonth(); const certMonth = certDate.getMonth();
const certURL = `https://freecodecamp.org${pathname}`; const certURL = `https://freecodecamp.org${pathname}`;
@ -282,9 +282,9 @@ class ShowCertification extends Component {
</div> </div>
</Col> </Col>
<Col md={7} sm={12}> <Col md={7} sm={12}>
<div className='issue-date'> <div data-cy='issue-date' className='issue-date'>
Issued&nbsp; Issued&nbsp;
<strong>{format(certDate, 'MMMM D, YYYY')}</strong> <strong>{format(certDate, 'MMMM d, y')}</strong>
</div> </div>
</Col> </Col>
</header> </header>

View File

@ -3,10 +3,10 @@ import PropTypes from 'prop-types';
import CalendarHeatMap from '@freecodecamp/react-calendar-heatmap'; import CalendarHeatMap from '@freecodecamp/react-calendar-heatmap';
import { Row } from '@freecodecamp/react-bootstrap'; import { Row } from '@freecodecamp/react-bootstrap';
import ReactTooltip from 'react-tooltip'; import ReactTooltip from 'react-tooltip';
import addDays from 'date-fns/add_days'; import addDays from 'date-fns/addDays';
import addMonths from 'date-fns/add_months'; import addMonths from 'date-fns/addMonths';
import startOfDay from 'date-fns/start_of_day'; import startOfDay from 'date-fns/startOfDay';
import isEqual from 'date-fns/is_equal'; import isEqual from 'date-fns/isEqual';
import FullWidthRow from '../../helpers/FullWidthRow'; import FullWidthRow from '../../helpers/FullWidthRow';
import Spacer from '../../helpers/Spacer'; import Spacer from '../../helpers/Spacer';

View File

@ -80,7 +80,8 @@ class TimelineInner extends Component {
renderCompletion(completed) { renderCompletion(completed) {
const { idToNameMap, username } = this.props; 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); const { challengeTitle, challengePath, certPath } = idToNameMap.get(id);
return ( return (
<tr className='timeline-row' key={id}> <tr className='timeline-row' key={id}>
@ -99,8 +100,8 @@ class TimelineInner extends Component {
)} )}
</td> </td>
<td className='text-center'> <td className='text-center'>
<time dateTime={format(completedDate, 'YYYY-MM-DDTHH:MM:SSZ')}> <time dateTime={completedDate.toISOString()}>
{format(completedDate, 'MMMM D, YYYY')} {format(completedDate, 'MMMM d, y')}
</time> </time>
</td> </td>
</tr> </tr>