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

Align internal and fecha date/time formatting #9380

Merged

Conversation

spacegaier
Copy link
Member

Breaking change

Proposed change

I noticed that on Win 10 my FF browser for timestamps in the first hours of the day shows a leading zero for the hour e.g. 08:15. Our internal formatting does not do that, but fecha does (so it looks like the internal formatting is not supported there any more?). In Chrome however, I do not see that leading zero, meaning the internal formatting is used instead of fecha.

This PR now aligns the formatting to be consistent between the two. This means that for the 24 hour format we will show two digit hour values. For AM/PM format we will not as that seems to be the customary format and fecha also does not add the leading zero there (probably because with "AM" or "PM" at the end it is already long enough).

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

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:

@github-actions
Copy link

github-actions bot commented Sep 4, 2021

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@github-actions github-actions bot added the stale label Sep 4, 2021
@spacegaier
Copy link
Member Author

Still valid. Waiting for review.

@github-actions github-actions bot removed the stale label Sep 4, 2021
@bramkragten
Copy link
Member

Why not remove the leading zero from fecha?

@spacegaier
Copy link
Member Author

Why not remove the leading zero from fecha?

Might be a personal preference, but to me the leading zero is always preferable, since it ensures a constant width for a time display independent of the time (so 01:30 is as wide as 22:30 is). Results in nicer UIs in my opinion.

@bramkragten bramkragten merged commit 605172a into home-assistant:dev Sep 6, 2021
@spacegaier spacegaier deleted the consistent-date-time-format branch September 6, 2021 08:25
@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 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.

None yet

3 participants