Skip to content

Commit

Permalink
Use relative date
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed May 28, 2024
1 parent 8fc8a33 commit 88fb1d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/panels/profile/ha-refresh-tokens-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,16 @@ class HaRefreshTokens extends LitElement {
<div slot="description">
${token.expire_at
? this.hass.localize(
"ui.panel.profile.refresh_tokens.expire_after_90_days"
"ui.panel.profile.refresh_tokens.expires_in",
{
date: relativeTime(
new Date(token.expire_at),
this.hass.locale
),
}
)
: this.hass.localize(
"ui.panel.profile.refresh_tokens.never_expire"
"ui.panel.profile.refresh_tokens.never_expires"
)}
</div>
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6373,8 +6373,8 @@
"created_at": "Created {date}",
"last_used": "Last used {date} from {location}",
"not_used": "Has never been used",
"expire_after_90_days": "Expires after 90 days of inactivity",
"never_expire": "Never expires",
"expires_in": "Expires {date}",
"never_expires": "Never expires",
"disable_token_expiration": "Disable token expiration",
"enable_token_expiration": "Enable token expiration",
"confirm_disable_token_expiration_title": "Disable token expiration?",
Expand Down

0 comments on commit 88fb1d9

Please sign in to comment.