/time> (no datetime attribute) ----
if (document.body.classList.contains('view-list')) {
var order = dateOrder();
document.querySelectorAll('time.blog-date').forEach(function (el) {
var m = (el.textContent || '').trim().match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);
if (!m) return; // already done, or unexpected text
var a = parseInt(m[1], 10), b = parseInt(m[2], 10), y = parseInt(m[3], 10);
var day = order === 'DMY' ? a : b;
var month = (order === 'DMY' ? b : a) - 1;
if (y < 100) y += 2000; // 25 -> 2025
if (month < 0 || month > 11) return;
el.textContent = day + ' ' + SHORT[month] + ' ' + y; // 18 Nov 2025
});
}
// ---- Single article: header shows no year, so read the real date from JSON-LD ----
if (document.body.classList.contains('view-item')) {
var published = null;
document.querySelectorAll('script[type="application/ld+json"]').forEach(function (s) {
if (published) return;
try {
var j = JSON.parse(s.textContent);
if (j && j['@type'] === 'Article' && j.datePublished) published = j.datePublished;
} catch (e) {}
});
if (!published) return;
var iso = published.match(/^(\d{4})-(\d{2})-(\d{2})/);
if (!iso) return;
var text = parseInt(iso[3], 10) + ' ' + LONG[parseInt(iso[2], 10) - 1] + ' ' + iso[1]; // 12 June 2026
document.querySelectorAll('time.blog-meta-item--date').forEach(function (el) {
var span = el.querySelector('span');
(span || el).textContent = text;
});
}
}
document.addEventListener('DOMContentLoaded', formatDates);
window.addEventListener('load', formatDates); // harmless second pass
})();