Skip to content

Commit d4d4283

Browse files
author
shleewhite
committed
fix: return empty string if invalid date for tooltip text
1 parent dc965d6 commit d4d4283

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/components/src/components/hds/time/index.hbs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
{{~#if this.hasTooltip~}}
99
<Hds::TooltipButton
1010
class="hds-time-wrapper"
11-
{{! @glint-expect-error: FIXME: pnpm migration }}
1211
@text={{if
1312
display.options.tooltipFormat
1413
(hds-format-date this.date display.options.tooltipFormat)

packages/components/src/components/hds/time/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,16 @@ export default class HdsTime extends Component<HdsTimeSignature> {
8787
return this.args.hasTooltip ?? true;
8888
}
8989

90-
get isoUtcString(): string | undefined {
90+
get isoUtcString(): string {
9191
const date = this.date;
9292

9393
if (dateIsValid(date)) {
94-
return this.hdsTime.toIsoUtcString(date);
94+
const isoUtcString = this.hdsTime.toIsoUtcString(date);
95+
96+
if (isoUtcString) return isoUtcString;
9597
}
9698

97-
return undefined;
99+
return '';
98100
}
99101

100102
get rangeIsoUtcString(): string {

0 commit comments

Comments
 (0)