import React from 'react' import Byline from '../Byline' import type { ArticleQuery } from '@financial-times/cp-content-pipeline-client' import ftDateFormat from '@financial-times/ft-date-format' type ArticleInfoProps = { content: ArticleQuery['content'] } const ArticleInfo: React.FC> = ({ children, content, }) => { const isLiveBlogPackage = content.__typename === 'LiveBlogPackage' const formattedFirstPublishedDate = ftDateFormat.format( new Date(content.firstPublishedDate), 'date' ) const formattedPublishedDate = ftDateFormat.format( new Date(content.publishedTimestamp), 'date' ) const displayPublishedDate = content.publishedDate && !isLiveBlogPackage const displayUpdatedDate = new Date(content.firstPublishedDate).getTime() !== content.publishedTimestamp const isPublishedMoreThanOneDayAgo = Date.now() - new Date(content.firstPublishedDate).getTime() > 24 * 60 * 60 * 1000 return (
{content.byline && content.__typename !== 'Audio' && ( )}
{!displayPublishedDate && children}
{displayPublishedDate && (

Published

{displayUpdatedDate && (

Updated

)}
{children}
)}
) } export default ArticleInfo