import React from "react"; import numeral from "numeral"; import { DATE_FIELD, DATE_TIME_FIELD, FRAME_NUMBER_FIELD, FRAME_SUPPORT_FIELD, INT_FIELD, } from "@fiftyone/utilities"; import { getDateTimeRangeFormattersWithPrecision } from "../../utils/generic"; export const getFormatter = (fieldType: string, timeZone: string, bounds) => { let hasTitle = false; let dtFormatters; const date = [DATE_TIME_FIELD, DATE_FIELD].includes(fieldType); if (date) { dtFormatters = getDateTimeRangeFormattersWithPrecision( timeZone, bounds[0], bounds[1] ); hasTitle = dtFormatters[0] !== null; } return { hasTitle, formatter: (v) => { if (date) { const str = dtFormatters[1].format(v).split(","); if (str.length === 1) { const day = str[0].split("-"); if (day.length === 3) { const [y, m, d] = day; return (