fix(charts): timezones accounted for and lint fixed (#20)

<!-- greptile_comment -->

<h3>Greptile Summary</h3>


Refactored timezone handling to use epoch timestamps throughout the data pipeline, with frontend using `Intl` API for PST/PDT-aware display formatting. Added TypeScript types to Chart.js tooltip callbacks and removed unused color scale legend. Updated build configuration to use explicit Node.js adapter and ignore build directory in ESLint.

**Key Changes:**
- Backend now returns epoch timestamps instead of formatted date strings, with SQL bucketing using fixed PST offset
- Frontend uses `epochToPSTComponents()` and `dateStringToEpochPST()` utilities for consistent timezone conversion
- Simplified `formatLabels()` to handle all `groupBy` options uniformly using epoch parsing
- Removed dead code (`fRange` calculation and color scale legend in `SpectrumStatsChart.svelte`)

**Critical Issue:**
- Backend bucketing uses a fixed 8-hour PST offset, which will cause incorrect time bucketing during PDT (March-November when offset is 7 hours). This means data could be grouped into wrong hour/day buckets during daylight saving time.

<h3>Confidence Score: 2/5</h3>


- This PR contains a critical timezone bug that will cause data bucketing errors during daylight saving time
- The frontend timezone handling is correct and well-implemented using the Intl API. However, the backend SQL bucketing logic uses a fixed 8-hour PST offset that doesn't account for PDT (7-hour offset during daylight saving time). This will cause timestamps to be bucketed incorrectly from March to November, potentially grouping data into wrong hours or days. The lint fixes and config changes are solid.
- Pay close attention to `netflow-webapp/src/routes/api/netflow/stats/+server.ts` - the bucketing logic needs DST handling

<h3>Important Files Changed</h3>




| Filename | Overview |
|----------|----------|
| netflow-webapp/src/routes/api/netflow/stats/+server.ts | Backend timezone bucketing refactored to use epoch calculations, but uses fixed PST offset that won't handle PDT correctly |
| netflow-webapp/src/lib/components/charts/chart-utils.ts | Refactored label formatting to use epoch timestamps with PST conversion via Intl API |
| netflow-webapp/src/lib/components/charts/SpectrumStatsChart.svelte | Added TypeScript types to tooltip callbacks and removed unused color scale legend code |

</details>



<h3>Sequence Diagram</h3>

```mermaid
sequenceDiagram
    participant User as User Browser
    participant Dashboard as NetflowDashboard
    participant API as /api/netflow/stats
    participant DB as SQLite Database
    participant ChartUtils as chart-utils.ts
    participant Chart as Chart.js

    User->>Dashboard: Select date range (YYYY-MM-DD)
    Dashboard->>Dashboard: dateStringToEpochPST(startDate)
    Dashboard->>Dashboard: dateStringToEpochPST(endDate, true)
    Note over Dashboard: Converts PST date strings<br/>to epoch timestamps<br/>using Intl API (handles DST)
    
    Dashboard->>API: GET /api/netflow/stats?startDate={epoch}&endDate={epoch}&groupBy=...
    
    API->>API: getBucketStartQuery(groupBy)
    Note over API: Creates SQL expression with<br/>FIXED 8-hour PST offset<br/>(ISSUE: breaks during PDT)
    
    API->>DB: Query with bucket calculation:<br/>(timestamp + 28800) / bucket_size * bucket_size - 28800
    DB-->>API: Returns rows with bucket_start (epoch)
    
    API-->>Dashboard: JSON: [{time: "epoch_string", data: "..."}]
    
    Dashboard->>ChartUtils: formatLabels(results, groupBy)
    ChartUtils->>ChartUtils: epochToPSTComponents(epoch)
    Note over ChartUtils: Converts epoch to PST<br/>using Intl API (handles DST)
    ChartUtils-->>Dashboard: ["YYYY-MM-DD HH:mm", ...]
    
    Dashboard->>Chart: Render chart with formatted labels
```

<!-- greptile_other_comments_section -->

<!-- /greptile_comment -->
ce922885baoliver committed on 1/22/2026, 8:58:52 PM· committed by GitHubparents24cca5b4964263
7 files changedLine totals unavailable