Skip to content
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

Relative time formatting inconsistent with Home Assistant #1228

Open
awahlig opened this issue Feb 12, 2025 · 0 comments
Open

Relative time formatting inconsistent with Home Assistant #1228

awahlig opened this issue Feb 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@awahlig
Copy link

awahlig commented Feb 12, 2025

Describe the bug
When displaying Last Changed of an entity, the relative time on the Bubble Card is sometimes displayed differently than how it's shown in HA. The value is sometimes off by 1 ("4 hours" on the card, "5 hours" in HA).

Specifically, I'm seeing this for a binary_sensor and a "State" Bubble Card. Tapping the card shows the "more info" view where HA's formatting can be seen.

Looking at the code, I think it's because Bubble Card uses Math.floor() whereas HA uses Math.round():
https://github.com/home-assistant/frontend/blob/56ab29da81402ba469f47b4f55bba7f28c5bdf52/src/common/util/select-unit.ts#L20

To Reproduce
Steps to reproduce the behavior:

  1. Enable showing of Last Changed on a card.
  2. Compare the time with what HA is showing.

Expected behavior
The formatting should ideally be consistent with HA.

Informations (please complete the following information):

  • Bubble Card version: 2.4.0
  • Home Assistant version: 2025.2.2
@awahlig awahlig added the bug Something isn't working label Feb 12, 2025
@awahlig awahlig changed the title Relative time inconsistent with HASS Relative time inconsistent with HA Feb 12, 2025
@awahlig awahlig changed the title Relative time inconsistent with HA Relative time formatting inconsistent with Home Assistant Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant