Skip to content

Commit

Permalink
Merge pull request #5283 from cyril-ui-developer/null-creation-timest…
Browse files Browse the repository at this point in the history
…amp-shows-50yrs

Bug 1824358: null creationTimestamp shows as relative time of 50 years ago
  • Loading branch information
openshift-merge-robot committed May 5, 2020
2 parents ed3b247 + 5ccb5b8 commit 3e4f166
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions frontend/public/components/utils/timestamp.tsx
Expand Up @@ -60,6 +60,11 @@ const timestampFor = (mdate: Date, now: Date, omitSuffix: boolean) => {
const nowStateToProps = ({ UI }) => ({ now: UI.get('lastTick') });

export const Timestamp = connect(nowStateToProps)((props: TimestampProps) => {
// Check for null. If props.timestamp is null, it returns incorrect date and time of Wed Dec 31 1969 19:00:00 GMT-0500 (Eastern Standard Time)
if (!props.timestamp) {
return <div className="co-timestamp">-</div>;
}

const mdate = props.isUnix
? new Date((props.timestamp as number) * 1000)
: new Date(props.timestamp);
Expand Down

0 comments on commit 3e4f166

Please sign in to comment.