Skip to content

Commit f474b19

Browse files
authored
Time - fix type error where TooltipButton text could be undefined (#2877)
1 parent 85ebe9c commit f474b19

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.changeset/itchy-ravens-shout.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hashicorp/design-system-components": patch
3+
---
4+
5+
`Time` - fixed type error where the TooltipButton text could be undefined.

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)