claude-usage-dashboard 1.5.8 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/js/app.js +6 -2
- package/server/routes/api.js +8 -1
package/package.json
CHANGED
package/public/js/app.js
CHANGED
|
@@ -74,9 +74,13 @@ async function loadQuota() {
|
|
|
74
74
|
if (window && sevenDay.utilization > 0) {
|
|
75
75
|
quotaWindowFrom = window.from;
|
|
76
76
|
quotaWindowTo = window.to;
|
|
77
|
+
// Use local date-only format (YYYY-MM-DD) to match the date picker's
|
|
78
|
+
// filtering — filterByDateRange treats date-only strings as local
|
|
79
|
+
// midnight boundaries, ensuring consistent results across all views.
|
|
80
|
+
const fmtD = d => `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`;
|
|
77
81
|
const cost7d = await fetchCost({
|
|
78
|
-
from: window.from
|
|
79
|
-
to: window.to
|
|
82
|
+
from: fmtD(window.from),
|
|
83
|
+
to: fmtD(window.to),
|
|
80
84
|
plan: state.plan.plan,
|
|
81
85
|
});
|
|
82
86
|
cost7dValue = cost7d.api_equivalent_cost_usd;
|
package/server/routes/api.js
CHANGED
|
@@ -149,9 +149,16 @@ export function createApiRouter(logBaseDir, options = {}) {
|
|
|
149
149
|
// Recompute current cycle from parsed records — in sync mode this
|
|
150
150
|
// includes all machines' data, matching /api/cost and /api/usage.
|
|
151
151
|
// The snapshot's utilization % (from the quota API) is preserved.
|
|
152
|
+
// Convert UTC cycle dates to local date-only strings (YYYY-MM-DD) so
|
|
153
|
+
// filterByDateRange uses local midnight boundaries, matching the date
|
|
154
|
+
// picker's range that drives the summary cards and /api/cost.
|
|
155
|
+
const toLocalDate = (iso) => {
|
|
156
|
+
const d = new Date(iso);
|
|
157
|
+
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`;
|
|
158
|
+
};
|
|
152
159
|
const records = refreshRecords();
|
|
153
160
|
const cycleRecords = filterByDateRange(
|
|
154
|
-
records, data.currentCycle.start, data.currentCycle.resets_at
|
|
161
|
+
records, toLocalDate(data.currentCycle.start), toLocalDate(data.currentCycle.resets_at)
|
|
155
162
|
);
|
|
156
163
|
const quotaShim = {
|
|
157
164
|
seven_day: { utilization: data.currentCycle.overall.utilization },
|