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
Add last-changed date to more-info #16509
Conversation
859ede7
to
ce85b32
Compare
src/components/ha-absolute-time.ts
Outdated
private _startInterval(): void { | ||
this._clearInterval(); | ||
|
||
// update every 60 seconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to update an absolute time every 60 secs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update it every hour (HH:00)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The format change if it's the same day or not.
const _to = to ?? new Date();
if (isSameDay(from, _to)) {
return formatTime(from, locale);
}
if (isSameYear(from, _to)) {
return formatShortDateTime(from, locale);
}
return formatShortDateTimeWithYear(from, locale);
The check is now done every hour.
At midnight, the display value should change from 8:23 AM
to Aug 9, 2021, 8:23 AM
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we could just calc the ms to next day instead of doing it every hour? And if it is already not the same day we dont have to do it at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, But I would prefer to update it every day because of formatShortDateTimeWithYear
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a pretty big edge case, how many times will a page be open for so long without refresh/update, etc?
74fd650
to
ad2ea98
Compare
ad2ea98
to
dfe79fd
Compare
Proposed change
Some changes to more-info :
last-changed
date : Easter eggs : the date format can toggled from relative to absolute by clicking on it. The year is display if the year is the same as today. The day is not displayed if the day is the same as today.CleanShot.2023-05-11.at.15.26.56.mp4
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: