[PR #6662] [MERGED] fix(clients): clarify renewal preview times and estimates #6400

Closed
opened 2026-11-02 04:08:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6662
Author: @JacktheRanger
Created: 9/27/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @MHSanaei

Base: main ← Head: fix/renewal-preview-time-display


📝 Commits (2)

  • f15b1c3 fix(clients): clarify renewal preview times and estimates
  • cf54f74 test(clients): remove redundant renewal preview copy checks

📊 Changes

19 files changed (+194 additions, -35 deletions)

View changed files

📝 docs/content/docs/en/config/clients.mdx (+10 -0)
📝 docs/content/docs/zh/config/clients.mdx (+8 -0)
📝 frontend/src/pages/clients/ClientRenewalFields.tsx (+36 -7)
📝 frontend/src/test/client-bulk-calendar-renewal.test.tsx (+5 -1)
📝 frontend/src/test/client-calendar-renewal.test.tsx (+3 -1)
➕ frontend/src/test/client-renewal-preview-display.test.tsx (+80 -0)
📝 internal/web/translation/ar-EG.json (+4 -2)
📝 internal/web/translation/en-US.json (+4 -2)
📝 internal/web/translation/es-ES.json (+4 -2)
📝 internal/web/translation/fa-IR.json (+4 -2)
📝 internal/web/translation/id-ID.json (+4 -2)
📝 internal/web/translation/ja-JP.json (+4 -2)
📝 internal/web/translation/pt-BR.json (+4 -2)
📝 internal/web/translation/ru-RU.json (+4 -2)
📝 internal/web/translation/tr-TR.json (+4 -2)
📝 internal/web/translation/uk-UA.json (+4 -2)
📝 internal/web/translation/vi-VN.json (+4 -2)
📝 internal/web/translation/zh-CN.json (+4 -2)
📝 internal/web/translation/zh-TW.json (+4 -2)

📄 Description

Summary

Clarify the client renewal preview introduced in #6524. Display readable dates with explicit UTC offsets, explain the panel/server timezone, and make clear that the renewal count is an estimate rather than a record of completed renewals.

Why

With the panel timezone set to Local, a user currently sees Renewal preview (Local) beside a raw value such as 2026-09-27T05:00:00Z. This is easy to mistake for browser-local time. Periods charged: 1 can also look like opening the preview already consumed a renewal.

The backend already returns each date in the panel's timezone. Converting those values through a browser-local Date would introduce another misleading clock, particularly around calendar boundaries and DST changes.

Changes

  • Render YYYY-MM-DD HH:mm:ss[.fraction] UTC±HH:mm, preserving the backend's wall time and each date's own offset. Z becomes UTC+00:00; fractional seconds remain intact.
  • Identify the panel timezone in the heading and translate Local as Server local time. Named zones such as America/New_York remain visible.
  • Explain that previewing does not renew the client; change the counter to Estimated renewals used.
  • Use the same formatting on the first-cutoff button, retain the original RFC3339 value in semantic <time datetime> elements, and keep dates left-to-right in RTL layouts.
  • Allow the preview and first-cutoff button to wrap within narrow forms.
  • Update the affected strings in all 13 locales and the English/Chinese client documentation. Add UTC, DST and fractional-offset/precision regression cases; retain single-client and bulk-form save coverage.

Type and scope

  • Bug fix
  • Frontend (client edit/create and bulk-create forms)
  • Documentation and tests

How was this tested?

On macOS arm64 with Node 26.4.0, Go 1.27.1 and golangci-lint 2.14.0:

  • GODEBUG=tlsmlkem=0,http2client=0 make verify — passed after the review follow-up: generated-file consistency, Go/frontend lint, formatting, typechecking, shuffled uncached Go tests, 175 frontend test files / 1,742 tests, production frontend/Go builds and Storybook build. The GODEBUG setting was local only; no CI configuration changed.
  • In frontend: TZ=America/Los_Angeles npm test -- --project components src/test/client-renewal-preview-display.test.tsx src/test/client-calendar-renewal.test.tsx src/test/client-bulk-calendar-renewal.test.tsx — 3 files / 5 tests passed. This intentionally uses a browser/host timezone different from the UTC and server-offset fixtures. The updated assertions failed against the old raw-date presentation before the implementation was changed.
  • Ran each of those five cases in a separate Vitest process, checking that each invocation reported exactly one passing test (commands below).
  • In docs: pnpm typecheck && pnpm lint && pnpm format:check && pnpm test — passed, 12 files / 106 tests.
  • Local Chromium visual check using the actual component in a temporary mocked-response harness: Chinese desktop (960px), Chinese mobile (375px), English first-cutoff button (375px), and Arabic RTL (375px), with browser timezone America/Los_Angeles. All four retained the server's 05:00:00 UTC+00:00; document width equaled viewport width after fixing button wrapping. Temporary harness files are not included in this PR.
  • git diff --check — passed. No dependency, lockfile or generated API/schema changes.
Per-case isolation commands (from frontend/)
TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-renewal-preview-display.test.tsx -t '^explains Local UTC without con'
TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-renewal-preview-display.test.tsx -t '^preserves different offsets ac'
TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-renewal-preview-display.test.tsx -t '^keeps fractional cutoffs and f'
TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-calendar-renewal.test.tsx -t '^preserves monthly clients, pre'
TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-bulk-calendar-renewal.test.tsx -t '^keeps bulk renewal disabled by'

Display example

For a Local server returning UTC dates:

Renewal preview (panel time zone: Server local time)
Dates use the panel time zone. Previewing does not renew the client.
Renewal boundary: 2026-09-27 05:00:00 UTC+00:00
Valid through: 2026-09-27 04:59:59 UTC+00:00
Cutoff after renewal: 2026-09-28 05:00:00 UTC+00:00
Estimated renewals used: 1

Chromium screenshots were inspected locally; there is no hosted screenshot attachment in this PR.

Review follow-up

Addressed the LOW finding about tests that only pin constant translation wording. Removed the duplicate locale-only case and redundant exact-text comparisons. The remaining cases exercise timezone selection, timestamp formatting/precision and real single-client/bulk-form behavior. This follow-up changes tests only; production behavior and translations are unchanged.

Compatibility, risks and intentionally unchanged behavior

No breaking changes, migrations or new dependencies. No API, database, scheduler, renewal arithmetic, saved expiry, subscription, traffic reset or first-use behavior changes. Selecting a renewal mode still does not rewrite an existing expiry; the first-cutoff button remains an explicit form edit that must be saved.

Formatting intentionally preserves the existing Gregorian backend dates instead of converting them to the browser timezone or another calendar. Each timestamp keeps its own offset across DST. The formatter relies on the existing backend RFC3339 response contract; it is not a new general-purpose date parser.

No new requests, telemetry, logging or external data sharing. No CI/release workflow changes. PostgreSQL-specific integration and race targets were not run separately for this presentation-only change.

Checklist

  • Tested locally and confirmed the described behavior.
  • Added/updated regression tests for the new display.
  • Repository make verify passes, including Go builds/tests and frontend lint/typecheck/build.
  • Updated affected documentation and all locale keys.
  • Conventional commit with a descriptive body; no unrelated changes.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6662 **Author:** [@JacktheRanger](https://github.com/JacktheRanger) **Created:** 9/27/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/renewal-preview-time-display` --- ### 📝 Commits (2) - [`f15b1c3`](https://github.com/MHSanaei/3x-ui/commit/f15b1c33147b4443afceccfeba70e75a24622ebf) fix(clients): clarify renewal preview times and estimates - [`cf54f74`](https://github.com/MHSanaei/3x-ui/commit/cf54f748d010b6e371964def0c166f1b981354b1) test(clients): remove redundant renewal preview copy checks ### 📊 Changes **19 files changed** (+194 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/en/config/clients.mdx` (+10 -0) 📝 `docs/content/docs/zh/config/clients.mdx` (+8 -0) 📝 `frontend/src/pages/clients/ClientRenewalFields.tsx` (+36 -7) 📝 `frontend/src/test/client-bulk-calendar-renewal.test.tsx` (+5 -1) 📝 `frontend/src/test/client-calendar-renewal.test.tsx` (+3 -1) ➕ `frontend/src/test/client-renewal-preview-display.test.tsx` (+80 -0) 📝 `internal/web/translation/ar-EG.json` (+4 -2) 📝 `internal/web/translation/en-US.json` (+4 -2) 📝 `internal/web/translation/es-ES.json` (+4 -2) 📝 `internal/web/translation/fa-IR.json` (+4 -2) 📝 `internal/web/translation/id-ID.json` (+4 -2) 📝 `internal/web/translation/ja-JP.json` (+4 -2) 📝 `internal/web/translation/pt-BR.json` (+4 -2) 📝 `internal/web/translation/ru-RU.json` (+4 -2) 📝 `internal/web/translation/tr-TR.json` (+4 -2) 📝 `internal/web/translation/uk-UA.json` (+4 -2) 📝 `internal/web/translation/vi-VN.json` (+4 -2) 📝 `internal/web/translation/zh-CN.json` (+4 -2) 📝 `internal/web/translation/zh-TW.json` (+4 -2) </details> ### 📄 Description ## Summary Clarify the client renewal preview introduced in #6524. Display readable dates with explicit UTC offsets, explain the panel/server timezone, and make clear that the renewal count is an estimate rather than a record of completed renewals. ## Why With the panel timezone set to `Local`, a user currently sees `Renewal preview (Local)` beside a raw value such as `2026-09-27T05:00:00Z`. This is easy to mistake for browser-local time. `Periods charged: 1` can also look like opening the preview already consumed a renewal. The backend already returns each date in the panel's timezone. Converting those values through a browser-local `Date` would introduce another misleading clock, particularly around calendar boundaries and DST changes. ## Changes - Render `YYYY-MM-DD HH:mm:ss[.fraction] UTC±HH:mm`, preserving the backend's wall time and each date's own offset. `Z` becomes `UTC+00:00`; fractional seconds remain intact. - Identify the panel timezone in the heading and translate `Local` as **Server local time**. Named zones such as `America/New_York` remain visible. - Explain that previewing does not renew the client; change the counter to **Estimated renewals used**. - Use the same formatting on the first-cutoff button, retain the original RFC3339 value in semantic `<time datetime>` elements, and keep dates left-to-right in RTL layouts. - Allow the preview and first-cutoff button to wrap within narrow forms. - Update the affected strings in all 13 locales and the English/Chinese client documentation. Add UTC, DST and fractional-offset/precision regression cases; retain single-client and bulk-form save coverage. ## Type and scope - [x] Bug fix - [x] Frontend (client edit/create and bulk-create forms) - [x] Documentation and tests ## How was this tested? On macOS arm64 with Node 26.4.0, Go 1.27.1 and golangci-lint 2.14.0: - `GODEBUG=tlsmlkem=0,http2client=0 make verify` — passed after the review follow-up: generated-file consistency, Go/frontend lint, formatting, typechecking, shuffled uncached Go tests, **175 frontend test files / 1,742 tests**, production frontend/Go builds and Storybook build. The `GODEBUG` setting was local only; no CI configuration changed. - In `frontend`: `TZ=America/Los_Angeles npm test -- --project components src/test/client-renewal-preview-display.test.tsx src/test/client-calendar-renewal.test.tsx src/test/client-bulk-calendar-renewal.test.tsx` — **3 files / 5 tests passed**. This intentionally uses a browser/host timezone different from the UTC and server-offset fixtures. The updated assertions failed against the old raw-date presentation before the implementation was changed. - Ran each of those five cases in a separate Vitest process, checking that each invocation reported exactly one passing test (commands below). - In `docs`: `pnpm typecheck && pnpm lint && pnpm format:check && pnpm test` — passed, **12 files / 106 tests**. - Local Chromium visual check using the actual component in a temporary mocked-response harness: Chinese desktop (960px), Chinese mobile (375px), English first-cutoff button (375px), and Arabic RTL (375px), with browser timezone `America/Los_Angeles`. All four retained the server's `05:00:00 UTC+00:00`; document width equaled viewport width after fixing button wrapping. Temporary harness files are not included in this PR. - `git diff --check` — passed. No dependency, lockfile or generated API/schema changes. <details> <summary>Per-case isolation commands (from frontend/)</summary> ```sh TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-renewal-preview-display.test.tsx -t '^explains Local UTC without con' TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-renewal-preview-display.test.tsx -t '^preserves different offsets ac' TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-renewal-preview-display.test.tsx -t '^keeps fractional cutoffs and f' TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-calendar-renewal.test.tsx -t '^preserves monthly clients, pre' TZ=America/Los_Angeles node node_modules/vitest/vitest.mjs run --project components src/test/client-bulk-calendar-renewal.test.tsx -t '^keeps bulk renewal disabled by' ``` </details> ## Display example For a `Local` server returning UTC dates: ```text Renewal preview (panel time zone: Server local time) Dates use the panel time zone. Previewing does not renew the client. Renewal boundary: 2026-09-27 05:00:00 UTC+00:00 Valid through: 2026-09-27 04:59:59 UTC+00:00 Cutoff after renewal: 2026-09-28 05:00:00 UTC+00:00 Estimated renewals used: 1 ``` Chromium screenshots were inspected locally; there is no hosted screenshot attachment in this PR. ## Review follow-up Addressed the LOW finding about tests that only pin constant translation wording. Removed the duplicate locale-only case and redundant exact-text comparisons. The remaining cases exercise timezone selection, timestamp formatting/precision and real single-client/bulk-form behavior. This follow-up changes tests only; production behavior and translations are unchanged. ## Compatibility, risks and intentionally unchanged behavior No breaking changes, migrations or new dependencies. No API, database, scheduler, renewal arithmetic, saved expiry, subscription, traffic reset or first-use behavior changes. Selecting a renewal mode still does not rewrite an existing expiry; the first-cutoff button remains an explicit form edit that must be saved. Formatting intentionally preserves the existing Gregorian backend dates instead of converting them to the browser timezone or another calendar. Each timestamp keeps its own offset across DST. The formatter relies on the existing backend RFC3339 response contract; it is not a new general-purpose date parser. No new requests, telemetry, logging or external data sharing. No CI/release workflow changes. PostgreSQL-specific integration and race targets were not run separately for this presentation-only change. ## Checklist - [x] Tested locally and confirmed the described behavior. - [x] Added/updated regression tests for the new display. - [x] Repository `make verify` passes, including Go builds/tests and frontend lint/typecheck/build. - [x] Updated affected documentation and all locale keys. - [x] Conventional commit with a descriptive body; no unrelated changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6400
No description provided.