fix(client): format cert date in user's timezone (#39440)

This commit is contained in:
Oliver Eyton-Williams
2020-08-20 13:16:10 +02:00
committed by GitHub
parent c8acd13b31
commit 8c70ea6b62
2 changed files with 3 additions and 4 deletions

View File

@ -5,7 +5,6 @@ import dedent from 'dedent';
import { Observable } from 'rx'; import { Observable } from 'rx';
import debug from 'debug'; import debug from 'debug';
import { isEmail } from 'validator'; import { isEmail } from 'validator';
import format from 'date-fns/format';
import { reportError } from '../middlewares/sentry-error-handler.js'; import { reportError } from '../middlewares/sentry-error-handler.js';
import { ifNoUser401 } from '../utils/middleware'; import { ifNoUser401 } from '../utils/middleware';
@ -542,7 +541,7 @@ function createShowCert(app) {
certTitle, certTitle,
username, username,
name, name,
date: format(new Date(completedDate), 'MMMM D, YYYY'), date: completedDate,
completionTime completionTime
}); });
} }

View File

@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import format from 'date-fns/format';
import { Grid, Row, Col, Image, Button } from '@freecodecamp/react-bootstrap'; import { Grid, Row, Col, Image, Button } from '@freecodecamp/react-bootstrap';
import FreeCodeCampLogo from '../assets/icons/freeCodeCampLogo'; import FreeCodeCampLogo from '../assets/icons/freeCodeCampLogo';
// eslint-disable-next-line max-len // eslint-disable-next-line max-len
@ -45,7 +46,6 @@ const propTypes = {
errored: PropTypes.bool errored: PropTypes.bool
}), }),
isDonating: PropTypes.bool, isDonating: PropTypes.bool,
issueDate: PropTypes.string,
showCert: PropTypes.func.isRequired, showCert: PropTypes.func.isRequired,
signedInUserName: PropTypes.string, signedInUserName: PropTypes.string,
userFetchState: PropTypes.shape({ userFetchState: PropTypes.shape({
@ -250,7 +250,7 @@ class ShowCertification extends Component {
<Col md={7} sm={12}> <Col md={7} sm={12}>
<div className='issue-date'> <div className='issue-date'>
Issued&nbsp; Issued&nbsp;
<strong>{issueDate}</strong> <strong>{format(new Date(issueDate), 'MMMM D, YYYY')}</strong>
</div> </div>
</Col> </Col>
</header> </header>