import Header from '../Header'; import type { Locale } from '../../interface'; import type { GenerateConfig } from '../../generate'; import { useInjectPanel } from '../../PanelContext'; import { formatValue } from '../../utils/dateUtil'; import useMergeProps from '../../hooks/useMergeProps'; export type TimeHeaderProps = { prefixCls: string; value?: DateType | null; locale: Locale; generateConfig: GenerateConfig; format: string; }; function TimeHeader(_props: TimeHeaderProps) { const props = useMergeProps(_props); const { hideHeader } = useInjectPanel(); if (hideHeader.value) { return null; } const { prefixCls, generateConfig, locale, value, format } = props; const headerPrefixCls = `${prefixCls}-header`; return (
{value ? formatValue(value, { locale, format, generateConfig, }) : '\u00A0'}
); } TimeHeader.displayName = 'TimeHeader'; TimeHeader.inheritAttrs = false; export default TimeHeader;