Skip to content

Format dates with lingui/core#1730

Merged
myieye merged 7 commits into
developfrom
format-dates-with-lingui
Jun 5, 2025
Merged

Format dates with lingui/core#1730
myieye merged 7 commits into
developfrom
format-dates-with-lingui

Conversation

@myieye

@myieye myieye commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator

Turns out we already had a date-formatter in lingui/core, so I dropped the one that bits-ui uses.

It still supports the current locale, but implicitly, because lingui already knows what the current locale is.

English:
image

French:
image

@coderabbitai

coderabbitai Bot commented Jun 4, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This update removes the old date formatting component and its exports, introduces a new Svelte date formatting component and utility function, and updates imports and usage in the project to use the new function-based approach. Localization files are updated to support a placeholder for formatted dates and to adjust metadata.

Changes

Files/Groups Change Summary
frontend/viewer/src/lib/components/ui/format-date/format-date.svelte,
.../format-date/index.ts
Deleted the old Svelte date formatting component and its passthrough export module.
frontend/viewer/src/lib/components/ui/format/format-date.svelte,
.../format/index.ts
Added new Svelte date formatting component and utility function, with centralized exports.
frontend/viewer/src/locales/en.json,
.../es.json,
.../fr.json
Updated translation metadata, marked old "Last change" entries obsolete, and added new entries with placeholders.
frontend/viewer/src/project/SyncDialog.svelte Refactored to use the new formatDate function instead of the old component for date display.

Poem

A bunny with a calendar hopped in today,
Swapped old date tricks for a shiny new way.
Functions now format with elegant grace,
While translations keep up, not missing a pace.
Out with the old, in with the neat—
Now every date is a localized treat!
🗓️🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions

github-actions Bot commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

UI unit Tests

10 tests  ±0   10 ✅ ±0   0s ⏱️ ±0s
 3 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 63c3a26. ± Comparison against base commit f15593b.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

C# Unit Tests

116 tests  ±0   116 ✅ ±0   9s ⏱️ -1s
 17 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 63c3a26. ± Comparison against base commit f15593b.

♻️ This comment has been updated with latest results.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
frontend/viewer/src/locales/es.json (1)

1063-1065: Provide Spanish translation for new placeholder key
The obsolete static "Last change: " entry is marked obsolete, and the new "rZkl7/" key needs a proper Spanish translation (e.g. "Último cambio: {0}").

frontend/viewer/src/locales/en.json (1)

1063-1065: Remove or translate obsolete entry
The static "Last change: " entry is marked obsolete. Consider removing it entirely or ensuring the new placeholder key "rZkl7/" supersedes it in all translations.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58e6a31 and 269c0c2.

⛔ Files ignored due to path filters (1)
  • frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • frontend/viewer/src/lib/components/ui/format-date/format-date.svelte (0 hunks)
  • frontend/viewer/src/lib/components/ui/format-date/index.ts (0 hunks)
  • frontend/viewer/src/lib/components/ui/format/format-date.svelte (1 hunks)
  • frontend/viewer/src/lib/components/ui/format/index.ts (1 hunks)
  • frontend/viewer/src/locales/en.json (4 hunks)
  • frontend/viewer/src/locales/es.json (4 hunks)
  • frontend/viewer/src/locales/fr.json (4 hunks)
  • frontend/viewer/src/project/SyncDialog.svelte (3 hunks)
💤 Files with no reviewable changes (2)
  • frontend/viewer/src/lib/components/ui/format-date/index.ts
  • frontend/viewer/src/lib/components/ui/format-date/format-date.svelte
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build API / publish-api
  • GitHub Check: Analyze (csharp)
  • GitHub Check: Build FW Lite and run tests
🔇 Additional comments (6)
frontend/viewer/src/lib/components/ui/format/index.ts (1)

1-6: Centralized export of date formatting utilities looks good
This new module cleanly re-exports both the Svelte component and the utility function for date formatting.

frontend/viewer/src/locales/es.json (1)

21-21: Verify updated origin line reference
The "mpbC3j" key’s origin is now pointing to line 233 in SyncDialog.svelte. Please confirm this matches the updated source.

frontend/viewer/src/project/SyncDialog.svelte (1)

13-13: Good: importing the new formatDate utility
This replaces the old component-based import. Ensure that all old FormatDate imports are removed across the codebase.

frontend/viewer/src/locales/en.json (1)

21-21: Verify updated origin line references
Several keys ("mpbC3j", "UNnBU9", "ivpwMF") have updated line numbers in SyncDialog.svelte. Please confirm these align with the refactored template.

Also applies to: 1930-1930, 1950-1950

frontend/viewer/src/locales/fr.json (1)

1066-1081: LGTM! Localization key properly updated for inline date formatting.

The transition from "Last change: " to "Last change: {0}" with a placeholder correctly supports the new function-based date formatting approach. The obsolete marking of the old key ensures proper cleanup.

frontend/viewer/src/lib/components/ui/format/format-date.svelte (1)

12-32: Excellent implementation of the new date formatting component.

The component properly:

  • Uses modern Svelte 5 syntax with $props() and $derived()
  • Handles HTML attributes correctly via spread
  • Provides a clean API with sensible defaults
  • Integrates well with lingui/core for localized formatting

This aligns perfectly with the PR objective of leveraging lingui/core's built-in date formatting capabilities.

Comment thread frontend/viewer/src/project/SyncDialog.svelte
Comment thread frontend/viewer/src/lib/components/ui/format/format-date.svelte
@myieye myieye force-pushed the format-dates-with-lingui branch from 269c0c2 to 2b7d8af Compare June 4, 2025 10:30
@argos-ci

argos-ci Bot commented Jun 4, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ✅ No changes detected - Jun 5, 2025, 7:18 AM

@myieye myieye enabled auto-merge (squash) June 4, 2025 15:37
hahn-kev and others added 4 commits June 5, 2025 12:43
# Conflicts:
#	frontend/viewer/src/lib/components/ui/format/format-date.svelte
#	frontend/viewer/src/lib/components/ui/format/index.ts
#	frontend/viewer/src/lib/sandbox/Sandbox.svelte
#	frontend/viewer/src/project/SyncDialog.svelte
@myieye myieye merged commit 32f4945 into develop Jun 5, 2025
25 checks passed
@myieye myieye deleted the format-dates-with-lingui branch June 5, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants