Updated date formatting for locales.

This commit is contained in:
Mike Cao 2021-02-26 22:41:05 -08:00
parent 50bc2371b8
commit d6d0f99daa
6 changed files with 25 additions and 24 deletions

View file

@ -3,7 +3,7 @@ import classNames from 'classnames';
import ChartJS from 'chart.js';
import Legend from 'components/metrics/Legend';
import { formatLongNumber } from 'lib/format';
import { dateFormat, timeFormat } from 'lib/lang';
import { dateFormat } from 'lib/date';
import useLocale from 'hooks/useLocale';
import useTheme from 'hooks/useTheme';
import { DEFAUL_CHART_HEIGHT, DEFAULT_ANIMATION_DURATION, THEME_COLORS } from 'lib/constants';
@ -46,7 +46,7 @@ export default function BarChart({
case 'minute':
return index % 2 === 0 ? dateFormat(d, 'H:mm', locale) : '';
case 'hour':
return timeFormat(d, locale);
return dateFormat(d, 'p', locale);
case 'day':
if (records > 31) {
if (w <= 500) {
@ -93,9 +93,9 @@ export default function BarChart({
function getTooltipFormat(unit) {
switch (unit) {
case 'hour':
return 'EEE ha — MMM d yyyy';
return 'EEE p — PPP';
default:
return 'EEE MMMM d yyyy';
return 'PPPP';
}
}