Skip to content

refactor(admin): centralize date formatting, fix null-timestamp rendering, and correct table filter attribute#1746

Merged
Shreyag02 merged 10 commits into
mainfrom
chore/unify-date-format-filter-fixes
Jul 21, 2026
Merged

refactor(admin): centralize date formatting, fix null-timestamp rendering, and correct table filter attribute#1746
Shreyag02 merged 10 commits into
mainfrom
chore/unify-date-format-filter-fixes

Conversation

@Shreyag02

@Shreyag02 Shreyag02 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Unifies admin date formatting via a shared helper, fixes a null-timestamp rendering bug, and re-enables table column filters that were silently broken. Aligns the admin UI with Apsara.

Changes

  • Shared helper: DATE_FORMAT + formatTimestamp in connect-timestamp.ts as the single source for the format string and null guard; migrated 32 call sites (dropped 11 YYYY-MM-DD cols, 6 toLocaleString, 15 dayjs imports).
  • Unified format: all admin dates use Apsara's default DD MMM YYYY; preferences keeps its time part.
  • Null-timestamp fix: zero/null-time values ({ seconds: 0 }) previously rendered 01 Jan 1970 / Invalid Date; now show -.
  • Filter fix:
    • Replaced stale, ignored filterVariant with Apsara's filterType on the older list tables.
    • Added enableColumnFilter: true to every column declaring a filterType — the required gate that lists a column in the filter menu (filterType alone is inert). Intentional exclusions keep enableColumnFilter: false.
    • Enabled the dead date filters on organizations/list, users/list, and products/prices "creation date".
  • Review feedback:
    • Import the helper via the ~/admin alias; call formatTimestamp(getValue()) inline.
    • apis: use formatTimestamp and fix accessorKey (created_atcreatedAt) to match the server sort key / fieldNameMapping.
    • pat: read createdAt/expiresAt via getValue() instead of row.original.
  • Cleanup: plan-card uses the client SDK's DEFAULT_DATE_SHORT_FORMAT; removed the dead getFormattedDateString helper in apps/admin.

Notes

  • DD MMM YYYY is Apsara's built-in default and matches the client SDK — canonical, not arbitrary.
  • Filters were broken because these tables predate the Apsara-v1 DataTable migration and kept filterVariant, which the new API ignores; it needs both filterType and enableColumnFilter: true. filterVariant also threw 3 TS errors in products/columns.tsx.
  • Scope: 30 files (26 views, 1 helper, 1 client, 2 apps/admin). No API/data-fetching changes beyond formatting, the null fix, and filter enablement.

Test Plan

  • Manual — dates render as DD MMM YYYY across all admin views; null/missing show -; affected columns filter again.
  • tsc clean on changed files; eslint shows only pre-existing warnings.

SQL Safety (if your PR touches *_repository.go or goqu.*)

N/A

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Jul 21, 2026 7:55am

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Admin SDK views centralize timestamp formatting, update table filter configuration, remove legacy date helpers, and use a shared short-date fallback in the client plan card.

Changes

Admin SDK display updates

Layer / File(s) Summary
Shared timestamp formatting
web/sdk/admin/utils/connect-timestamp.ts
Adds the shared date format and formatTimestamp helper with missing and null timestamp fallbacks.
Timestamp rendering migration
web/sdk/admin/views/invoices/..., web/sdk/admin/views/organizations/..., web/sdk/admin/views/plans/..., web/sdk/admin/views/products/..., web/sdk/admin/views/users/..., web/sdk/admin/views/audit-logs/..., web/sdk/admin/views/webhooks/...
Admin tables and detail views delegate timestamp rendering to the shared formatter.
Filter and date configuration
web/sdk/admin/views/admins/columns.tsx, web/sdk/admin/views/preferences/columns.tsx, web/sdk/admin/views/roles/columns.tsx, web/sdk/admin/views/plans/columns.tsx, web/sdk/admin/views/products/..., web/sdk/admin/views/webhooks/..., web/sdk/admin/views/organizations/details/apis/columns.tsx
Text and date filters use filterType, and the API created-at column uses the shared date format.
Legacy helper removal and client fallback
web/apps/admin/src/utils/constants.ts, web/apps/admin/src/utils/helper.ts, web/sdk/client/views/plans/components/plan-card.tsx
Removes obsolete admin date helpers and uses DEFAULT_DATE_SHORT_FORMAT for the plan card fallback.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: rohanchkrabrty, rohilsurana, rsbh

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.

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

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

@Shreyag02 Shreyag02 changed the title fix(admin): unify date format with Apsara and correct table filter at… fix(admin): unify date format with Apsara and correct table filter attribute Jul 10, 2026
@Shreyag02
Shreyag02 requested a review from rohanchkrabrty July 10, 2026 06:47
@coveralls

coveralls commented Jul 10, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29812224075

Coverage remained the same at 46.201%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 38436
Covered Lines: 17758
Line Coverage: 46.2%
Coverage Strength: 13.36 hits per line

💛 - Coveralls

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/sdk/admin/views/plans/details.tsx (1)

22-25: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider simplifying the IIFE to a concise expression.

The immediately-invoked function expression works but can be replaced with optional chaining and nullish coalescing for the same behavior.

♻️ Optional simplification
           <Text size="mini">
-            {(() => {
-              const date = timestampToDayjs(plan?.createdAt);
-              return date ? date.format("DD MMM YYYY") : "-";
-            })()}
+            {timestampToDayjs(plan?.createdAt)?.format("DD MMM YYYY") ?? "-"}
           </Text>

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 82f02392-ccc4-46d9-8b24-54445eb5043f

📥 Commits

Reviewing files that changed from the base of the PR and between ff27bf5 and eaba5d7.

📒 Files selected for processing (18)
  • web/sdk/admin/views/admins/columns.tsx
  • web/sdk/admin/views/invoices/columns.tsx
  • web/sdk/admin/views/organizations/details/apis/columns.tsx
  • web/sdk/admin/views/organizations/details/apis/details-dialog.tsx
  • web/sdk/admin/views/organizations/details/invoices/columns.tsx
  • web/sdk/admin/views/organizations/details/members/columns.tsx
  • web/sdk/admin/views/organizations/details/projects/columns.tsx
  • web/sdk/admin/views/organizations/details/tokens/columns.tsx
  • web/sdk/admin/views/organizations/list/columns.tsx
  • web/sdk/admin/views/plans/columns.tsx
  • web/sdk/admin/views/plans/details.tsx
  • web/sdk/admin/views/preferences/columns.tsx
  • web/sdk/admin/views/preferences/details.tsx
  • web/sdk/admin/views/products/columns.tsx
  • web/sdk/admin/views/products/prices/columns.tsx
  • web/sdk/admin/views/roles/columns.tsx
  • web/sdk/admin/views/users/list/columns.tsx
  • web/sdk/admin/views/webhooks/webhooks/columns.tsx

Comment thread web/sdk/admin/views/plans/columns.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/sdk/admin/views/invoices/columns.tsx (1)

27-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider using timestampCell for consistency across timestamp columns.

This file wraps formatTimestamp in <Text> manually, while other files (e.g., organizations/details/invoices/columns.tsx, products/columns.tsx) use the shared timestampCell helper directly. Standardizing on timestampCell eliminates duplicated getValue() as TimeStamp casts and wrapper boilerplate. The same pattern appears in organizations/details/members/columns.tsx and organizations/list/columns.tsx.

If <Text> provides styling that a plain string return would lose, consider updating timestampCell to wrap its output in <Text> so all consumers get consistent styling.

♻️ Proposed refactor
-      cell: ({ getValue }) => (
-        <Text>{formatTimestamp(getValue() as TimeStamp)}</Text>
-      ),
+      cell: timestampCell,

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 72dff9b0-3c07-4955-b8cb-703d3fe1b413

📥 Commits

Reviewing files that changed from the base of the PR and between eaba5d7 and bd53577.

📒 Files selected for processing (15)
  • web/sdk/admin/utils/connect-timestamp.ts
  • web/sdk/admin/views/invoices/columns.tsx
  • web/sdk/admin/views/organizations/details/apis/details-dialog.tsx
  • web/sdk/admin/views/organizations/details/invoices/columns.tsx
  • web/sdk/admin/views/organizations/details/members/columns.tsx
  • web/sdk/admin/views/organizations/details/projects/columns.tsx
  • web/sdk/admin/views/organizations/details/tokens/columns.tsx
  • web/sdk/admin/views/organizations/list/columns.tsx
  • web/sdk/admin/views/plans/columns.tsx
  • web/sdk/admin/views/plans/details.tsx
  • web/sdk/admin/views/preferences/details.tsx
  • web/sdk/admin/views/products/columns.tsx
  • web/sdk/admin/views/products/prices/columns.tsx
  • web/sdk/admin/views/users/list/columns.tsx
  • web/sdk/admin/views/webhooks/webhooks/columns.tsx
🚧 Files skipped from review as they are similar to previous changes (7)
  • web/sdk/admin/views/organizations/details/projects/columns.tsx
  • web/sdk/admin/views/organizations/details/apis/details-dialog.tsx
  • web/sdk/admin/views/preferences/details.tsx
  • web/sdk/admin/views/users/list/columns.tsx
  • web/sdk/admin/views/plans/columns.tsx
  • web/sdk/admin/views/webhooks/webhooks/columns.tsx
  • web/sdk/admin/views/organizations/details/tokens/columns.tsx

Comment thread web/sdk/admin/views/products/prices/columns.tsx
@Shreyag02 Shreyag02 changed the title fix(admin): unify date format with Apsara and correct table filter attribute refactor(admin): centralize date formatting, fix null-timestamp rendering, and correct table filter attribute Jul 10, 2026
Comment thread web/sdk/admin/views/admins/columns.tsx
Comment thread web/sdk/admin/views/admins/columns.tsx
Comment thread web/sdk/admin/views/organizations/details/apis/columns.tsx Outdated
Comment thread web/sdk/admin/views/organizations/details/pat/columns.tsx Outdated
Comment thread web/sdk/admin/views/organizations/details/pat/columns.tsx Outdated
Comment thread web/sdk/admin/views/preferences/columns.tsx
Comment thread web/sdk/admin/views/products/prices/columns.tsx
Comment thread web/sdk/admin/views/products/columns.tsx
Comment thread web/sdk/admin/views/roles/columns.tsx
Comment thread web/sdk/admin/views/webhooks/webhooks/columns.tsx
@Shreyag02
Shreyag02 merged commit d34ae82 into main Jul 21, 2026
8 checks passed
@Shreyag02
Shreyag02 deleted the chore/unify-date-format-filter-fixes branch July 21, 2026 09:26
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.

3 participants