Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

537 B
Raw Blame
import { capitalize } from "@dub/utils";

// Generates a sanitized filename for exports with a timestamp
// Example: "Dub Links Export - 2025-10-27-15-49-12.csv"
export function generateExportFilename(exportType: string): string {
  // Sanitize timestamp: remove colons, replace T with hyphen, remove milliseconds and Z
  const sanitizedTimestamp = new Date()
    .toISOString()
    .replace(/:/g, "-")
    .replace("T", "-")
    .replace(/\.\d{3}Z$/, "");

  return `Dub ${capitalize(exportType)} Export - ${sanitizedTimestamp}.csv`;
}