-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Show the last bank sync in plain language instead of timestamp #4523
Show the last bank sync in plain language instead of timestamp #4523
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Bundle Stats — desktop-clientHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller
Unchanged
|
Bundle Stats — loot-coreHey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle. As this PR is updated, I'll keep you updated on how the bundle size is impacted. Total
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
WalkthroughThis pull request updates the way timestamps are displayed by removing a dedicated date formatting function and shifting to a relative time representation. In the Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/loot-core/src/shared/util.ts (1)
504-510
: Good implementation of conditional capitalizationThe new code elegantly handles capitalization when requested, maintaining the original string when not needed. This enhances the display flexibility of timestamps throughout the application.
One small note: For consistency, you might want to apply the same capitalization logic to the "Unknown" return value (line 497) when ts is null, as it's currently always capitalized regardless of the options setting.
- if (!ts) return 'Unknown'; + if (!ts) { + const text = 'unknown'; + return options.capitalize ? text.charAt(0).toUpperCase() + text.slice(1) : text; + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
upcoming-release-notes/4523.md
is excluded by!**/*.md
📒 Files selected for processing (2)
packages/desktop-client/src/components/banksync/AccountRow.tsx
(2 hunks)packages/loot-core/src/shared/util.ts
(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
packages/desktop-client/src/components/banksync/AccountRow.tsx (1)
Learnt from: matt-fidd
PR: actualbudget/actual#4253
File: packages/desktop-client/src/components/banksync/AccountRow.tsx:0-0
Timestamp: 2025-01-28T23:24:32.957Z
Learning: In the Actual codebase, timestamp formatting should use date-fns' `format` function with explicit format strings (e.g., 'HH:mm:ss' for time) instead of JavaScript's built-in `toLocaleTimeString()` for consistency.
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Functional
- GitHub Check: Visual regression
- GitHub Check: build (macos-latest)
- GitHub Check: build (windows-latest)
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (5)
packages/loot-core/src/shared/util.ts (1)
490-496
: Well-structured function signature enhancementThe function signature has been extended to include an optional
options
parameter with acapitalize
property, defaulting tofalse
. This improvement allows for more flexible text formatting while maintaining backward compatibility with existing calls.packages/desktop-client/src/components/banksync/AccountRow.tsx (4)
6-6
: Good use of shared utilitiesImporting the utility function from a shared location rather than defining it locally follows the DRY principle and promotes code consistency across the application.
9-9
: Appropriate hook replacementThe switch from a date format hook to using the global language preference aligns well with the move to relative time formatting, ensuring consistent localization across the app.
24-24
: Good default language handlingSetting a default language ('en-US') ensures the application behaves predictably even if the language preference isn't set.
26-28
: Improved user experience with relative timestampsUsing relative time with capitalization enhances readability and provides a more user-friendly representation of when an account was last synchronized. This change directly addresses the PR objective to "show the last bank sync in plain language instead of timestamp."
I'm applying knowledge from your previous feedback about timestamp formatting in the Actual codebase. This implementation properly uses date-fns formatting (via tsToRelativeTime) rather than JavaScript's built-in functions, maintaining consistency with the project's standards.
Thanks to the helper @tostasmistas introduced in #4459, this looks much better!
Before:

After:

Those screenshots are taken on different instances so the dates don't match.