Skip to content

Time - fix type error where TooltipButton text could be undefined #2877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2025

Conversation

shleewhite
Copy link
Contributor

@shleewhite shleewhite commented May 14, 2025

📌 Summary

If merged, this PR would resolve a type error where the TooltipButton text could be undefined. Opted to just return '' if the date is invalid or if it cannot be converted into a UTC ISO format because other functions like rangeIsoUtcString and the hds-format-time helper return an empty string if it is invalid.

Other options considered

  • use the JavaScript date methods as a fallback: not used because the case where this happens most likely is when it is an invalid date, so this would not work
  • update the TooltipButton to let the text argument be optional: not used because this would have much larger consequences and we'd rather ensure tooltips always have text.

🔗 External links

Jira ticket: HDS-4517


👀 Component checklist

💬 Please consider using conventional comments when reviewing this PR.

Copy link

vercel bot commented May 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
hds-showcase ✅ Ready (Inspect) Visit Preview May 14, 2025 9:39pm
hds-website ✅ Ready (Inspect) Visit Preview May 14, 2025 9:39pm

Copy link
Contributor

@KristinLBradley KristinLBradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@shleewhite shleewhite requested a review from a team May 14, 2025 22:09
@shleewhite shleewhite merged commit f474b19 into main May 15, 2025
16 checks passed
@shleewhite shleewhite deleted the hds-4517/time-types-issue branch May 15, 2025 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants