Added month select component.

This commit is contained in:
Mike Cao 2023-08-16 10:50:28 -07:00
parent 6ef1f2e9f9
commit c548267d91
16 changed files with 169 additions and 71 deletions

View file

@ -1,5 +1,5 @@
import { StatusLight } from 'react-basics';
import { dateFormat } from 'lib/date';
import { formatDate } from 'lib/date';
import { formatLongNumber } from 'lib/format';
export function renderNumberLabels(label) {
@ -12,15 +12,15 @@ export function renderDateLabels(unit, locale) {
switch (unit) {
case 'minute':
return dateFormat(d, 'h:mm', locale);
return formatDate(d, 'h:mm', locale);
case 'hour':
return dateFormat(d, 'p', locale);
return formatDate(d, 'p', locale);
case 'day':
return dateFormat(d, 'MMM d', locale);
return formatDate(d, 'MMM d', locale);
case 'month':
return dateFormat(d, 'MMM', locale);
return formatDate(d, 'MMM', locale);
case 'year':
return dateFormat(d, 'YYY', locale);
return formatDate(d, 'YYY', locale);
default:
return label;
}
@ -50,7 +50,7 @@ export function renderStatusTooltipPopup(unit, locale) {
setTooltipPopup(
<>
<div>{dateFormat(new Date(dataPoints[0].raw.x), formats[unit], locale)}</div>
<div>{formatDate(new Date(dataPoints[0].raw.x), formats[unit], locale)}</div>
<div>
<StatusLight color={labelColors?.[0]?.backgroundColor}>
{formatLongNumber(dataPoints[0].raw.y)} {dataPoints[0].dataset.label}