Records: format dates as YYYY-MM-DD for correct sort order

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul Trowbridge 2026-04-05 20:26:59 -04:00
parent b311092987
commit 2aa9e0fcdd

View File

@ -8,7 +8,12 @@ function formatVal(val) {
const s = String(val) const s = String(val)
if (DATE_RE.test(s)) { if (DATE_RE.test(s)) {
const d = new Date(s) const d = new Date(s)
if (!isNaN(d)) return d.toLocaleDateString(undefined, { year: '2-digit', month: 'short', day: 'numeric' }) if (!isNaN(d)) {
const y = d.getUTCFullYear()
const m = String(d.getUTCMonth() + 1).padStart(2, '0')
const day = String(d.getUTCDate()).padStart(2, '0')
return `${y}-${m}-${day}`
}
} }
return s return s
} }