Show day of week in analytics date formatting
Updated AdminAnalytics to include the day of the week in formatted dates, improving clarity in analytics displays. Dates now appear as 'Mon, Nov 21' instead of just 'Nov 21'.
This commit is contained in:
@@ -117,9 +117,13 @@ export default function AdminAnalytics() {
|
||||
? new Date(parseInt(parts[0]), parseInt(parts[1]) - 1, parseInt(parts[2]))
|
||||
: new Date(dateStr);
|
||||
|
||||
// Format with day of week: "Mon, Nov 21"
|
||||
const dayOfWeek = date.toLocaleDateString('en-GB', { weekday: 'short' });
|
||||
const monthDay = date.toLocaleDateString('en-GB', { month: 'short', day: 'numeric' });
|
||||
|
||||
return {
|
||||
date: dateStr,
|
||||
formattedDate: date.toLocaleDateString('en-GB', { month: 'short', day: 'numeric' }),
|
||||
formattedDate: `${dayOfWeek}, ${monthDay}`,
|
||||
value: Number(item[valueKey]) || 0,
|
||||
[valueKey]: Number(item[valueKey]) || 0
|
||||
};
|
||||
@@ -145,9 +149,13 @@ export default function AdminAnalytics() {
|
||||
? new Date(parseInt(parts[0]), parseInt(parts[1]) - 1, parseInt(parts[2]))
|
||||
: new Date(dateStr);
|
||||
|
||||
// Format with day of week: "Mon, Nov 21"
|
||||
const dayOfWeek = date.toLocaleDateString('en-GB', { weekday: 'short' });
|
||||
const monthDay = date.toLocaleDateString('en-GB', { month: 'short', day: 'numeric' });
|
||||
|
||||
return {
|
||||
date: dateStr,
|
||||
formattedDate: date.toLocaleDateString('en-GB', { month: 'short', day: 'numeric' }),
|
||||
formattedDate: `${dayOfWeek}, ${monthDay}`,
|
||||
orders: order.count || 0,
|
||||
revenue: revenueMap.get(dateStr) || 0
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user