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

fix: notification dates edge case #25148

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Jun 7, 2024

Description

Due to manual date comparisons, there were some weirdness with the dates displayed (such as a notification yesterday, but not 24 hours ago). This fix (using date built-ins) ensures correct notification dates.

NOTE - need to port this on other platforms.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

due to manual date diffing, there were some weirdness with the dates displayed (such as a notification yesterday, but not 24 hours ago).
This fix (using date built-ins) ensures correct notification dates.

NOTE - need to port this on other platforms
@Prithpal-Sooriya Prithpal-Sooriya requested review from a team as code owners June 7, 2024 17:00
Copy link
Contributor

github-actions bot commented Jun 7, 2024

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment on lines -37 to -38
const elapsed = Math.abs(Date.now() - date.getTime());
const diffDays = elapsed / (1000 * 60 * 60 * 24);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not using manual date diffing, instead using the Date object to check if dates are yesterday, today, or in same year (for more accurate notifications).

See test scenarios for more info.

Copy link
Contributor

@matteoscurati matteoscurati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Prithpal-Sooriya Prithpal-Sooriya added the team-notifications Notifications team label Jun 10, 2024
@legobeat legobeat changed the title fix: 🐛 notification dates edge case fix: notification dates edge case Jun 10, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [65f11f2]
Page Load Metrics (164 ± 218 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6811795147
domContentLoaded9301252
load432147164455218
domInteractive9301252
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 176 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.77%. Comparing base (254ac95) to head (65f11f2).
Report is 15 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #25148      +/-   ##
===========================================
+ Coverage    65.76%   65.77%   +0.01%     
===========================================
  Files         1362     1362              
  Lines        54101    54110       +9     
  Branches     14045    14048       +3     
===========================================
+ Hits         35579    35588       +9     
  Misses       18522    18522              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@chakra-guy chakra-guy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Prithpal-Sooriya Prithpal-Sooriya merged commit 453b2b5 into develop Jun 13, 2024
84 of 85 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the NOTIFY-679-validate-feature-announcement-created-at-date branch June 13, 2024 10:18
@github-actions github-actions bot locked and limited conversation to collaborators Jun 13, 2024
@metamaskbot metamaskbot added the release-12.1.0 Issue or pull request that will be included in release 12.1.0 label Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.1.0 Issue or pull request that will be included in release 12.1.0 team-notifications Notifications team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants