dotcom-rendering/src/components/FeatureCardCardAge.tsx (25 lines of code) (raw):
import { isWithinTwelveHours } from '../lib/formatTime';
import { palette } from '../palette';
import { CardAge } from './Card/components/CardAge';
type Props = {
showClock: boolean;
absoluteServerTimes: boolean;
webPublicationDate: string;
};
export const FeatureCardCardAge = ({
showClock,
absoluteServerTimes,
webPublicationDate,
}: Props) => {
const withinTwelveHours = isWithinTwelveHours(webPublicationDate);
if (withinTwelveHours) {
return (
<CardAge
webPublication={{
date: webPublicationDate,
isWithinTwelveHours: true,
}}
showClock={showClock}
absoluteServerTimes={absoluteServerTimes}
isTagPage={false}
colour={palette('--feature-card-footer-text')}
/>
);
}
return null;
};