Skip to content

Commit 3dc0fb6

Browse files
author
Eric Olkowski
committed
Updated spread props to prevent duplicate datetime attribute
1 parent 8ed62c6 commit 3dc0fb6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/react-core/src/components/Timestamp/Timestamp.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,15 @@ export const Timestamp: React.FunctionComponent<TimestampProps> = ({
127127
});
128128
const defaultTooltipContent = `${utcDateString}${tooltip?.suffix ? ' ' + tooltip.suffix : ' UTC'}`;
129129

130+
const { dateTime, ...propsWithoutDateTime } = props;
131+
130132
const timestamp = (
131133
<span
132134
className={css(styles.timestamp, tooltip && styles.modifiers.helpText, className)}
133135
{...(tooltip && { tabIndex: 0 })}
134-
{...props}
136+
{...propsWithoutDateTime}
135137
>
136-
<time className="pf-c-timestamp__text" dateTime={props.dateTime || new Date(date).toISOString()}>
138+
<time className="pf-c-timestamp__text" dateTime={dateTime || new Date(date).toISOString()}>
137139
{!children ? defaultDisplay : children}
138140
</time>
139141
</span>

packages/react-core/src/components/Timestamp/__tests__/__snapshots__/Timestamp.test.tsx.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ exports[`Matches snapshot 1`] = `
44
<DocumentFragment>
55
<span
66
class="pf-c-timestamp"
7-
datetime="2022-01-01T00:00:00.000Z"
87
>
98
<time
109
class="pf-c-timestamp__text"

0 commit comments

Comments
 (0)