feat(usage): add live end time option for custom date range#4438
Open
arichyx wants to merge 4 commits into
Open
feat(usage): add live end time option for custom date range#4438arichyx wants to merge 4 commits into
arichyx wants to merge 4 commits into
Conversation
Add a "End time follows current time" checkbox in the custom date range picker. When enabled, the end time becomes read-only and automatically tracks the current moment, so usage data always reflects up-to-the-second consumption from the chosen start time. This is especially useful under the Coding Plan 5-hour quota window — users can set the start time to when their 5h window began and keep the end time live to monitor real-time token consumption.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 概述
Add a "End time follows current time" checkbox in the custom date range picker. When enabled, the end time field becomes read-only and automatically tracks the current moment, so usage data always reflects up-to-the-second consumption from the chosen start time.
在自定义日期范围选择器中新增 "结束时间跟随当前时刻" 复选框。勾选后,结束时间字段变为只读并自动跟随当前时刻,使使用统计数据始终反映从选定开始时间到此刻的实时消耗。
Motivation / 背景
Currently, when selecting a custom date range, the end time is a fixed snapshot — it's set to the moment you click "Confirm" and never updates afterward. To see the latest data, you have to close and reopen the picker every time.
This is especially painful under the Coding Plan 5-hour quota window. Users need to monitor how much of their 5h quota has been consumed from the window start time to right now. With the current fixed end time, the data becomes stale the moment you confirm — you can never see real-time consumption within a custom window.
目前选择自定义时间范围时,结束时间是点击"确认"那一刻的固定快照,之后不会更新。要看最新数据,必须反复关闭再打开选择器。
这在 Coding Plan 5 小时额度窗口 下尤其不便。用户需要监控从窗口开始时间到此刻的 token 消耗,但固定的结束时间让数据在确认的那一刻就过时了——无法在自定义窗口内查看实时消耗。
What this PR does / 改动内容
UsageRangeSelection— add optionalliveEndTime?: booleanfieldresolveUsageRange()— whenliveEndTimeis true,endDateresolves toDate.now()instead of the fixedcustomEndDatesnapshotUsageDateRangePicker— add a checkbox below the end time field; when checked:opacity-50,cursor-not-allowed,pointer-events-none)UsageDashboard— whenliveEndTimeis true, the range label shows"start → Now"instead of a stale end timestampusage.liveEndTimeandusage.liveEndTimeNowkeys for en/zh/zh-TW/jaScreenshots / 截图
Checklist / 检查清单
pnpm typecheckpasses / 通过 TypeScript 类型检查pnpm format:checkpasses / 通过代码格式检查cargo clippypasses (if Rust code changed) / 通过 Clippy 检查(如修改了 Rust 代码)— N/A, no Rust changes