fix: Archiv-Zeiten als America/New_York interpretieren (gegen RSS kalibriert, +DST)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-12 09:06:23 +00:00
parent 5f634452c3
commit c3114db05e

View File

@@ -51,6 +51,23 @@ console.log(`On-chain: ${onchainCount} Events`);
const pages = Number(args['truth-pages']);
const candidates: { symbol: string; ts: number; url: string }[] = [];
let oldestTs = Infinity;
/**
* Archiv-Zeiten sind US-Eastern OHNE Zeitzonen-Angabe (gegen RSS-pubDate kalibriert
* 2026-06-12: Offset exakt 4h = EDT). Interpretiert den String als America/New_York
* inkl. Sommer-/Winterzeit, ohne Dependency.
*/
function parseEasternTime(s: string): number {
const utcGuess = Date.parse(s + ' UTC');
if (Number.isNaN(utcGuess)) return NaN;
// Offset von New York zum Zeitpunkt utcGuess bestimmen (±1h Fehler durch DST-Grenze ist hier irrelevant)
const nyParts = new Intl.DateTimeFormat('en-US', { timeZone: 'America/New_York', timeZoneName: 'shortOffset' })
.formatToParts(new Date(utcGuess))
.find((p) => p.type === 'timeZoneName')?.value ?? 'GMT-5';
const m = nyParts.match(/GMT([+-]\d+)/);
const offsetH = m ? Number(m[1]) : -5;
return utcGuess - offsetH * 3600_000; // ET 9:49 PM = UTC 9:49 PM (4h) = 01:49 nächster Tag
}
for (let p = 1; p <= pages; p++) {
const res = await fetch(`https://trumpstruth.org/?page=${p}`, { signal: AbortSignal.timeout(20_000) });
if (!res.ok) { console.warn(`Seite ${p}: HTTP ${res.status} — Truth-Scan endet hier`); break; }
@@ -66,7 +83,7 @@ for (let p = 1; p <= pages; p++) {
// Post-Text aus status__content (nicht status-info__body — das ist der Autor-/Meta-Bereich)
const body = block.match(/status__content[^>]*>([\s\S]*?)<\/div>/)?.[1] ?? '';
if (!url || !timeRaw) continue;
const ts = Date.parse(timeRaw);
const ts = parseEasternTime(timeRaw);
if (Number.isNaN(ts)) continue;
oldestTs = Math.min(oldestTs, ts);
const text = body.replace(/<[^>]+>/g, ' ').replace(/\s+/g, ' ').trim();