Skip to content

Commit

Permalink
Format hourly view tooltips label with hour digits for the StatsEmail…
Browse files Browse the repository at this point in the history
…Detail page
  • Loading branch information
dognose24 committed Dec 5, 2024
1 parent 977c346 commit abda42e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/my-sites/stats/stats-email-chart-tabs/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function formatDate( date, period ) {
const momentizedDate = moment( date );
switch ( period ) {
case 'hour':
return momentizedDate.format( 'HH:mm' );
return momentizedDate.format( 'MMM D' );
case 'day':
return momentizedDate.format( 'LL' );
default:
Expand Down Expand Up @@ -57,10 +57,13 @@ export const buildChartData = memoizeLast( ( activeLegend, chartTab, data, perio
function addTooltipData( chartTab, item, period ) {
const tooltipData = [];
const label = ( () => {
const formatedDate = formatDate( item.data.period, period );

if ( 'hour' === period ) {
return item.label;
return `${ formatedDate } ${ item.label }`;
}
return formatDate( item.data.period, period );

return formatedDate;
} )();

tooltipData.push( {
Expand Down

0 comments on commit abda42e

Please sign in to comment.