fix: analytics queries use milliseconds for created_at_epoch #87

Merged
jonas.hanisch merged 1 commit from fix/analytics-epoch-milliseconds into main 2026-01-22 19:32:34 +00:00
Owner

Summary

  • Fix analytics queries to correctly handle created_at_epoch stored in milliseconds
  • startDate calculation now uses milliseconds: Date.now() - (daysBack * 24 * 60 * 60 * 1000)
  • date() function for daily grouping now divides epoch by 1000: date(created_at_epoch / 1000, 'unixepoch', 'localtime')

Problem

The "Memories Over Time" chart was only showing January 1st because the epoch timestamps were being treated as seconds instead of milliseconds.

Test Plan

  • Verify dashboard analytics endpoints return correct date ranges
  • Verify "Memories Over Time" chart shows actual dates

🤖 Generated with Claude Code

## Summary - Fix analytics queries to correctly handle `created_at_epoch` stored in milliseconds - `startDate` calculation now uses milliseconds: `Date.now() - (daysBack * 24 * 60 * 60 * 1000)` - `date()` function for daily grouping now divides epoch by 1000: `date(created_at_epoch / 1000, 'unixepoch', 'localtime')` ## Problem The "Memories Over Time" chart was only showing January 1st because the epoch timestamps were being treated as seconds instead of milliseconds. ## Test Plan - [x] Verify dashboard analytics endpoints return correct date ranges - [x] Verify "Memories Over Time" chart shows actual dates 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix: analytics queries use milliseconds for created_at_epoch
All checks were successful
CI / build (pull_request) Successful in 22s
CI / validate-plugin (pull_request) Successful in 2s
a5903ff47e
The created_at_epoch column stores timestamps in milliseconds, but
the analytics queries were treating them as seconds:

1. Changed token_count → discovery_tokens (column was renamed)
2. Fixed startDate calculation to use milliseconds
3. Fixed date() function to divide by 1000 for proper date grouping

This fixes the "Memories Over Time" chart showing only Jan 1st.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jonas.hanisch deleted branch fix/analytics-epoch-milliseconds 2026-01-22 19:32:34 +00:00
Sign in to join this conversation.
No description provided.