@mui/x-charts
Version:
The community edition of MUI X Charts components.
21 lines (19 loc) • 655 B
JavaScript
import useMediaQuery from '@mui/material/useMediaQuery';
export function utcFormatter(v) {
if (v instanceof Date) {
return v.toUTCString();
}
return v.toLocaleString();
}
// Taken from @mui/x-date-time-pickers
const mainPointerFineMediaQuery = '@media (pointer: fine)';
/**
* Returns true if the main pointer is fine (e.g. mouse).
* This is useful for determining how to position tooltips or other UI elements based on the type of input device.
* @returns true if the main pointer is fine, false otherwise.
*/
export const useIsFineMainPointer = () => {
return useMediaQuery(mainPointerFineMediaQuery, {
defaultMatches: true
});
};