Skip to content

[codex] Localize dashboard dates#2351

Open
riderx wants to merge 1 commit into
mainfrom
codex/localized-dashboard-dates
Open

[codex] Localize dashboard dates#2351
riderx wants to merge 1 commit into
mainfrom
codex/localized-dashboard-dates

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 28, 2026

Summary (AI generated)

  • Localized shared dashboard chart date labels, month buckets, and UTC date-time display helpers.
  • Updated admin and dashboard surfaces that still used fixed dayjs or browser-default date formats.
  • Added date helper coverage for date-only parsing, localized compact labels, month/year buckets, and chart range labels.
  • Added a narrow typo-check exclusion for an existing committed migration filename that cannot be safely renamed.

Motivation (AI generated)

Admin dashboards and chart-heavy views mixed English month formats, browser-default date formats, and day-number-only chart labels. This made dates inconsistent across locales and between chart axes, tooltips, billing-period labels, and usage/credit views.

Business Impact (AI generated)

This improves the dashboard experience for non-US and multilingual users by making date display consistent with the selected app language and local date conventions. It reduces confusion when reading usage, billing, credit, and release/adoption charts.

Test Plan (AI generated)

  • bun run lint
  • bun run lint:deadcode
  • bunx typos .
  • bunx vitest run tests/date.unit.test.ts
  • bun run typecheck:frontend
  • Commit hook ran full bun typecheck successfully

Generated with AI

Summary by CodeRabbit

Release Notes

  • Refactor

    • Standardized date and time formatting across the application for consistent display in dashboards, billing settings, usage reports, and statistics pages
    • Improved date handling for subscription periods and activity logs
  • Chores

    • Optimized database performance with new indexes
    • Updated test coverage for date formatting utilities

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Warning

Review limit reached

@riderx, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 9 minutes and 44 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 995d7d0a-bb00-40f4-a6ef-80609d3c2657

📥 Commits

Reviewing files that changed from the base of the PR and between a36abb4 and 4ae6f2d.

📒 Files selected for processing (11)
  • .typos.toml
  • read_replicate/schema_replicate.sql
  • src/components/admin/AdminMultiLineChart.vue
  • src/components/dashboard/AppAccess.vue
  • src/components/dashboard/Usage.vue
  • src/pages/app/[app].channel.[channel].statistics.vue
  • src/pages/settings/organization/Credits.vue
  • src/pages/settings/organization/Usage.vue
  • src/services/chartTooltip.ts
  • src/services/date.ts
  • tests/date.unit.test.ts
📝 Walkthrough

Walkthrough

This PR removes the dayjs dependency and replaces it with a custom date formatting service. The core date service is refactored to parse and format dates consistently using regex and the Intl API, adding new formatters for short and month-year variants. All UI components across the app are updated to use the new service, chart date range generation is refactored to produce formatted strings, and test coverage is expanded.

Changes

Dayjs removal and date service consolidation

Layer / File(s) Summary
Database schema and configuration
.typos.toml, read_replicate/schema_replicate.sql
Two new btree indexes added for query performance (idx_apps_default_upload_channel and idx_manifest_file_name), and migration file excluded from typos scanning.
Date service refactor and chart utilities
src/services/date.ts
Remove dayjs, add regex-based date-only parsing via parseDatePreservingUtc, refactor existing formatters to use consistent parser, introduce formatLocalDateShort and formatLocalMonthYear, simplify formatUtcDateTimeAsLocal (remove format parameter), and update generateChartDayLabels/generateMonthDays to return formatted date strings via getDatesInRange instead of day numbers.
Chart tooltip simplification
src/services/chartTooltip.ts
Simplify tooltip title/date logic by deriving dates directly from getDateFromIndex(...) and formatDateForTooltip(...), removing prior label-based billing-start adjustment logic.
UI component date formatting migration
src/components/admin/AdminMultiLineChart.vue, src/components/dashboard/AppAccess.vue, src/components/dashboard/Usage.vue, src/pages/app/[app].channel.[channel].statistics.vue, src/pages/settings/organization/Credits.vue, src/pages/settings/organization/Usage.vue
Replace all dayjs and native toLocaleDateString usage with new date service formatters (formatLocalDate, formatLocalDateShort, formatLocalMonthYear, formatLocalDateTime) across dashboard, settings, and statistics pages.
Date service test expansion
tests/date.unit.test.ts
Remove dayjs dependency, use production date helpers for expected values, expand test coverage with new cases for date-only formatting, invalid UTC handling, month-year formatting, and chart label generation.

Sequence Diagram(s)

No sequence diagram applicable. This PR updates internal date handling logic and UI rendering without introducing new multi-component flows or request/response sequences.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Suggested labels

codex

Suggested reviewers

  • jihadMo
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title '[codex] Localize dashboard dates' directly and concisely summarizes the main change: localization of dashboard date displays across multiple components and services.
Description check ✅ Passed The description covers the summary, motivation, and business impact well, and the test plan is detailed. However, required template sections 'Test plan' (steps to reproduce/test) and 'Screenshots' are missing, though the latter is noted as optional for backend changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

Review ran into problems

🔥 Problems

Linked repositories: Couldn't analyze Cap-go/capgo - clone failed: Clone operation failed: Stream initialization permanently failed: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing codex/localized-dashboard-dates (4ae6f2d) with main (00e3df3)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@riderx riderx force-pushed the codex/localized-dashboard-dates branch from c285f5f to 1ed744d Compare May 28, 2026 14:37
@riderx riderx force-pushed the codex/localized-dashboard-dates branch from 1ed744d to a36abb4 Compare May 28, 2026 14:47
@riderx riderx marked this pull request as ready for review May 28, 2026 15:00
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai coderabbitai Bot added the codex label May 28, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/services/date.ts`:
- Around line 13-18: The DATE_ONLY_RE branch currently builds a Date via new
Date(Number(year), Number(month) - 1, Number(day)) which normalizes overflow (so
values like 2026-02-31 become a different valid date); update the validation in
that branch (where dateOnlyMatch and parsed are used) to explicitly compare
parsed.getFullYear(), parsed.getMonth() + 1, and parsed.getDate() against the
original Number(year), Number(month), and Number(day) and return null if any
component differs, otherwise return parsed.

In `@tests/date.unit.test.ts`:
- Around line 34-39: The test hardcodes 'en' when building the expected label;
instead, call the same locale source used by production (getAppLocale()) so the
expected value matches formatLocalMonthYear() across locales—replace the
hardcoded 'en' in the Intl.DateTimeFormat call with getAppLocale() (or obtain
the locale via getAppLocale() first) to construct the expected month-year string
for the assertion against formatLocalMonthYear(date).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 08592162-5e86-40fc-bc40-83335bdd1210

📥 Commits

Reviewing files that changed from the base of the PR and between 00e3df3 and a36abb4.

📒 Files selected for processing (11)
  • .typos.toml
  • read_replicate/schema_replicate.sql
  • src/components/admin/AdminMultiLineChart.vue
  • src/components/dashboard/AppAccess.vue
  • src/components/dashboard/Usage.vue
  • src/pages/app/[app].channel.[channel].statistics.vue
  • src/pages/settings/organization/Credits.vue
  • src/pages/settings/organization/Usage.vue
  • src/services/chartTooltip.ts
  • src/services/date.ts
  • tests/date.unit.test.ts

Comment thread src/services/date.ts Outdated
Comment thread tests/date.unit.test.ts
@riderx riderx force-pushed the codex/localized-dashboard-dates branch from a36abb4 to 4ae6f2d Compare May 28, 2026 15:17
@sonarqubecloud
Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant