support targeting specific date

This commit is contained in:
2026-02-09 01:18:16 -08:00
parent 136a090b6d
commit c31484f0cf
4 changed files with 51 additions and 5 deletions

View File

@@ -5,16 +5,22 @@ import (
"log/slog"
"os"
"path/filepath"
"time"
)
func Run() error {
func Run(targetDate *time.Time) error {
snapshotDir, snapshotDate, err := FindLatestDailySnapshot()
if err != nil {
return fmt.Errorf("finding latest snapshot: %w", err)
}
slog.Info("found latest daily snapshot", "dir", snapshotDir, "snapshot_date", snapshotDate.Format("2006-01-02"))
targetDay := snapshotDate.AddDate(0, 0, -1)
var targetDay time.Time
if targetDate != nil {
targetDay = *targetDate
} else {
targetDay = snapshotDate.AddDate(0, 0, -1)
}
slog.Info("target day for extraction", "date", targetDay.Format("2006-01-02"))
// Check if output already exists