Skip to content

Allow timestamp attribute formatting + central timestamp formats#8162

Merged
spacegaier merged 6 commits intohome-assistant:devfrom
spacegaier:ha-attr-timestamp
Jan 22, 2021
Merged

Allow timestamp attribute formatting + central timestamp formats#8162
spacegaier merged 6 commits intohome-assistant:devfrom
spacegaier:ha-attr-timestamp

Conversation

@spacegaier
Copy link
Copy Markdown
Member

@spacegaier spacegaier commented Jan 14, 2021

Breaking change

Proposed change

  1. Centralize the definition of allowed timestamp formats rather than duplicating in many places.
  2. Allow setting of format for attributes in entities card to be consistent with entity state rendering.

If the attribute is not a valid timestamp value, then the hui-timestamp-display will show "Invalid timestamp".

Before:
image

After:
image

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

type: entities
entities:
  - type: attribute
    entity: sun.sun
    attribute: next_rising
    format: datetime
    secondary_info: last-changed
    name: Next sun rising
  - entity: sun.sun
    secondary_info: last-changed
state_color: true

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@bramkragten
Copy link
Copy Markdown
Member

Line 49 https://github.com/home-assistant/frontend/pull/8162/files#diff-a13b3324902aa8c7b840e2d4d5070732e46824007d67d1eaac62341ef756e92aR49 should be moved below the check for stateObj

@spacegaier spacegaier merged commit fe13853 into home-assistant:dev Jan 22, 2021
@spacegaier spacegaier deleted the ha-attr-timestamp branch January 22, 2021 19:24
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants