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

Add last-changed date to more-info #16509

Merged
merged 4 commits into from May 12, 2023
Merged

Add last-changed date to more-info #16509

merged 4 commits into from May 12, 2023

Conversation

piitaya
Copy link
Member

@piitaya piitaya commented May 11, 2023

Proposed change

Some changes to more-info :

  • Add 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.
  • Move the title back to header
  • Increase state size
CleanShot.2023-05-11.at.15.26.56.mp4

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:

@piitaya piitaya marked this pull request as ready for review May 11, 2023 13:59
private _startInterval(): void {
this._clearInterval();

// update every 60 seconds
Copy link
Member

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?

Copy link
Member Author

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)

Copy link
Member Author

@piitaya piitaya May 11, 2023

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.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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?

@frenck frenck added the Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear) label May 11, 2023
@bramkragten bramkragten enabled auto-merge (squash) May 12, 2023 09:36
@bramkragten bramkragten merged commit 75f080e into dev May 12, 2023
6 checks passed
@bramkragten bramkragten deleted the more-info-last-changed branch May 12, 2023 10:58
piitaya added a commit that referenced this pull request May 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed Noteworthy Marks a PR as noteworthy and should be in the release notes (in case it normally would not appear)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants