Update proptypes, use date function

This commit is contained in:
Alex Holliday committed 2024-09-14 10:57:46 +08:00
1 parent b3d16bfa25
commit 1e480a10e0
2 files changed
+5 -8

No files matched your search

@@ -85,9 +85,10 @@ const CustomToolTip = ({ active, payload, label }) => {
const CustomTick = ({ x, y, payload, index }) => {
const theme = useTheme();
const uiTimezone = useSelector((state) => state.ui.timezone);
// Render nothing for the first tick
if (index === 0) return null;
return (
<Text
x={x}
@@ -97,11 +98,7 @@ const CustomTick = ({ x, y, payload, index }) => {
fontSize={11}
fontWeight={400}
>
{formatDate(new Date(payload.value), {
year: undefined,
month: undefined,
day: undefined,
})}
{formatDateWithTz(payload?.value, "HH:mm:ss", uiTimezone)}
</Text>
);
};
@@ -42,8 +42,8 @@ const CustomLabels = ({
CustomLabels.propTypes = {
x: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
firstDataPoint: PropTypes.object.isRequired,
lastDataPoint: PropTypes.object.isRequired,
type: PropTypes.string.isRequired,