All files / components Date.tsx

100% Statements 4/4
25% Branches 1/4
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28            1x 2x                                     2x  
interface DateProps {
  id?: string
  label?: string
  date?: string
}
 
const Date = ({ id = 'mscaPlaceholder', label, date }: DateProps) => {
  const dateFormatted = date ? date.split('T')[0] : 'NA'
  return (
    <dl
      id={id}
      data-testid={id}
      className="mt-8 py-2 font-body text-gray-darker"
    >
      <dt className="inline">{label}</dt>
      <dd className="inline">
        {dateFormatted === 'NA' ? (
          <time>{` ${dateFormatted}`}</time>
        ) : (
          <time dateTime={dateFormatted}>{` ${dateFormatted}`}</time>
        )}
      </dd>
    </dl>
  )
}
 
export default Date