diff --git a/src/pages/experiences/usa.astro b/src/pages/experiences/usa.astro index 2bfa8dc..c94aa90 100644 --- a/src/pages/experiences/usa.astro +++ b/src/pages/experiences/usa.astro @@ -1,4 +1,5 @@ --- +import { execSync } from "child_process" import MainLayout from "../../layouts/MainLayout.astro" import Subheading from "../../components/Subheading.astro" // import USAMap from "../../components/maps/USAMap.jsx" @@ -50,6 +51,24 @@ const visitedStates = getUniqueStates(visitedPlaces) const allYears = getUniqueYears(visitedPlaces) const nationalParks = countNationalParks(visitedPlaces) +// Format last updated date +const DATA_FILE = "src/data/usa-travel-data.js" +let lastUpdatedFormatted: string | null = null +try { + const gitDate = execSync(`git log -1 --format=%cI -- ${DATA_FILE}`, { + encoding: "utf8", + }).trim() + if (gitDate) { + lastUpdatedFormatted = new Date(gitDate).toLocaleDateString("en-US", { + year: "numeric", + month: "long", + timeZone: "UTC", + }) + } +} catch { + // git unavailable at build time — omit the date +} + // Group places by category for better organization // const placesByCategory = groupPlacesByCategory(visitedPlaces) --- @@ -135,6 +154,11 @@ const nationalParks = countNationalParks(visitedPlaces)
Click on any of the places to see more details.
+ {lastUpdatedFormatted && ( ++ Map data last updated: {lastUpdatedFormatted} +
+ )}