Skip to content

Commit e4b9a22

Browse files
fix(dashboard): format dates as 'Sep 26' instead of ISO timestamp
The Daily Revenue table was showing dates as '2026-09-26T00:00:00.000Z'. Now shows friendly format like 'Sep 26'. Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
1 parent a8f7026 commit e4b9a22

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎scripts/self-host/demo-dashboard.html‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ <h3>🏆 Top 10 Products by Revenue</h3>
104104
GROUP BY DATE(created_at) ORDER BY day DESC
105105
`);
106106
if (revenue.rows && revenue.rows.length > 0) {
107+
const formatDate = (d) => {
108+
const date = new Date(d);
109+
const months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
110+
return `${months[date.getMonth()]} ${date.getDate()}`;
111+
};
107112
document.getElementById("revenue-table").innerHTML = `<table>
108113
<thead><tr><th>Date</th><th>Orders</th><th>Revenue</th></tr></thead>
109-
<tbody>${revenue.rows.map(r => `<tr><td>${r.day}</td><td>${Number(r.orders).toLocaleString()}</td><td>$${Number(r.revenue || 0).toLocaleString(undefined, {minimumFractionDigits: 2})}</td></tr>`).join("")}</tbody>
114+
<tbody>${revenue.rows.map(r => `<tr><td>${formatDate(r.day)}</td><td>${Number(r.orders).toLocaleString()}</td><td>$${Number(r.revenue || 0).toLocaleString(undefined, {minimumFractionDigits: 2})}</td></tr>`).join("")}</tbody>
110115
</table>`;
111116
}
112117

0 commit comments

Comments
 (0)