Fix: prevent published date reset when editing videos and show edited status

Prioritize `published_at` metadata over event `created_at` timestamp.
Backfill `published_at` during edit if missing to preserve original date.
Add "(edited)" label to video cards for modified content.
Display "Last Edited: [Date]" on video player modal.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-12 15:35:23 +00:00
1 parent 1ef8459fd6
commit 1d3c827f62
4 files changed
+112 -6

No files matched your search

+34
View File
@@ -90,3 +90,37 @@ export function formatTimeAgo(timestamp) {
}
return "just now";
}
/**
* Formats a timestamp (in seconds) to a long absolute date with ordinal day
* (e.g. "January 6th, 2026").
*/
export function formatAbsoluteDateWithOrdinal(timestamp) {
if (!Number.isFinite(timestamp)) {
return "";
}
const date = new Date(timestamp * 1000);
if (Number.isNaN(date.getTime())) {
return "";
}
// Helper for English ordinal suffixes
const getOrdinal = (n) => {
const s = ["th", "st", "nd", "rd"];
const v = n % 100;
return s[(v - 20) % 10] || s[v] || s[0];
};
try {
const month = date.toLocaleString("en-US", { month: "long" });
const day = date.getDate();
const year = date.getFullYear();
const suffix = getOrdinal(day);
return `${month} ${day}${suffix}, ${year}`;
} catch (err) {
// Fallback if locale fails
return date.toDateString();
}
}