Skip to content

Commit

Permalink
Change default date value from UNIX epoch to dash
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Apr 14, 2021
1 parent 9a425d5 commit b0b1415
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/EmailHeader/EmailHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ export default function EmailHeader({ datetime, from_name, from_email, to, cc })
<Typography variant="body2">{buildEmailNameString(from_name, from_email)}</Typography>
</Grid>
<Grid item xs={3}>
<Typography variant="body2" color="textSecondary" align="right"><RelativeTime value={datetime} /></Typography>
<Typography variant="body2" color="textSecondary" align="right">
{ datetime === "-"
? datetime
: <RelativeTime value={datetime} />
}
</Typography>
</Grid>
</Grid>
</Paper>
Expand All @@ -106,19 +111,19 @@ export default function EmailHeader({ datetime, from_name, from_email, to, cc })
EmailHeader.propTypes = {
/** Name of message sender. */
"from_name": PropTypes.string,
/** Date the message was sent in ISO 8601 format. */
/** Any string, number or Date object understood by React Relative Time. See https://github.com/aharshac/react-relative-time#readme. */
"datetime": PropTypes.string,
/** Email address of message sender. */
"from_email": PropTypes.string,
/** Array of people the message was sent to */
/** Array of objects with name and email keys for message recipients. */
"to": PropTypes.array,
/** Array of people the message was cc'd to */
/** Array of objects with name and email keys for message copies. */
"cc": PropTypes.array
};

EmailHeader.defaultProps = {
"from_name": "Name Unavailable",
"datetime": new Date(1970, 1, 1, 0, 0, 0, 0),
"datetime": "-",
"from_email": "Email Unavailable",
"to": [],
"cc": []
Expand Down

0 comments on commit b0b1415

Please sign in to comment.