🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 5 Min Lesezeit
0

Expiring Content: Put the Deadline in the Data, Not the Prose

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Introduction



I run several sites that publish time-limited information: Kindle manga sales, grocery and household deals. Everything on them expires.



That creates a structural weakness. Expired deals left on the page erode trust in the whole site. A reader clicks a link labeled "through July 31" and lands on a full-price page. After that happens a couple of times, they stop coming back.



Removing expired entries by hand does not scale; the more articles you have, the worse it gets. So I moved the deadline into the data and let the build decide what to show.






Architecture



Each article carries metrics.deadline in its JSON, and build.js computes the days remaining at generation time.




CODE
articles.json
└ metrics.deadline: "2026-07-31"
↓ build.js
daysUntil(deadline, survey date)

┌─ left < 0 → excluded from listings; article shows "may have ended"
├─ left == 0 → "today only" (emphasized)
├─ left <= 3 → "N days left" (emphasized)
└─ left > 3 → "N days left"






The key design decision is that the reference date is not today but the date the article was last verified. More on that below.






The core of the implementation



Computing days remaining is all there is to it.




CODE
// Parse an ISO date (YYYY-MM-DD) as JST and return days remaining from the
// survey date. Expired is negative, same day is 0. The base is the survey
// date (the article's last verification date), not today.
function daysUntil(deadlineIso, baseIso) {
const base = new Date((baseIso || surveyDate()) + "T00:00:00+09:00");
const dl = new Date(deadlineIso + "T00:00:00+09:00");
return Math.round((dl.getTime() - base.getTime()) / 864e5);
}






Spelling out +09:00 is the point. new Date("2026-07-31") parses as UTC, so running in JST shifts the result by nine hours and the date lands a day off. That surfaces as "today only" appearing a day early. If your dates carry a timezone, pin it at parse time.



The expiry check:




CODE
// A sale is ended only if it has a deadline and that deadline has passed
// relative to the survey date. Articles with no deadline data are never
// marked as ended (do not fabricate an ended state).
function isEnded(a) {
const dl = a && a.metrics && a.metrics.deadline;
return !!dl && daysUntil(dl) < 0;
}






As the comment says, articles without a deadline are deliberately not treated as ended. Displaying "this has ended" for something whose deadline is merely unknown would state something I have not verified. Deciding what not to render when data is missing is part of the spec for this kind of site.



Excluding them from listings is one filter.




CODE
// Ended sales: hidden from listings (top/category/tag/related/RSS/sitemap)
// but kept on the article page and in site search, so they stay reachable
// by direct URL.
function listedArticles() {
return articles.filter((a) => !isEnded(a));
}






Note that this filters rather than deletes. The reason follows.



Rendering branches on days remaining:




CODE
const left = daysUntil(m.deadline);
let leftTxt = "", cls = "fact-until";
if (left < 0) { leftTxt = "may have ended"; cls = "fact-until fact-expired"; }
else if (left === 0) { leftTxt = "today only"; cls = "fact-until fact-urgent"; }
else if (left <= 3) { leftTxt = `${left} days left`; cls = "fact-until fact-urgent"; }
else { leftTxt = `${left} days left`; }









What bit me



Using "today" as the reference date makes the article assert things I never checked.



Initially daysUntil was based on the execution date. That looks natural, and it breaks.



Deal information is written on the day the source was verified. Suppose on July 20 I confirm "through July 31". Rendering that in August correctly says "expired". The failure is the other direction: the deadline itself may have changed at the source. If it was extended or cut short, my data still says July 20's version. Presenting "5 days left" as today's information asserts a fact I have not verified.



So the base became the survey date.




CODE
const base = new Date((baseIso || surveyDate()) + "T00:00:00+09:00");






Now days remaining means "how many days were left at the time of verification". The wording follows: "as of the source and verification date, listed as running through July 31." Anything past the deadline reads "may have ended", because whether it actually ended is something I did not check.



Second: deleting expired articles kills URLs.



An earlier version dropped expired entries from generation entirely. That was wrong for both SEO and readers. Externally linked URLs began returning 404, and search traffic had nowhere to land.



Now they are removed from listings, RSS, and the sitemap, but kept on the article page and in site search. New discovery paths no longer surface them, while existing links keep working. A page that says "this sale may have ended" serves a reader far better than a 404.






The result



One of the sites running this: https://manga.autoarticles.net



It aggregates Kindle manga sales, each article showing a days-remaining badge. Expired entries drop out of the listings automatically.






Conclusion



If you handle time-limited information, put the deadline in the data, not the prose. Text that merely says "through July 31" is unreadable to the build, so the operation falls back to human labor.



And the choice of reference date determines what you are allowed to claim. Today's date produces assertions; the verification date produces "here is what was confirmed, and when". Pick the base that matches how certain your information actually is — that was the part of this implementation I thought hardest about.







This article is about my own side project. It was written with AI assistance.


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Expiring Content: Put the Deadline in the Data, Not the Prose

Thematisch verwandte Begriffe: Expiring, Content, Deadline, Data · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...