import { toDate } from '@graphcommerce/next-ui/Intl/DateTimeFormat/toDate' import { Box, type BoxProps } from '@mui/material' import type { ProductListItemFragment } from '../../graphql' export type ProductNewLabelProps = { product: Pick } & Omit export function ProductNewLabel(props: ProductNewLabelProps) { const { product, ...boxProps } = props const { new_from_date, new_to_date } = product const from = toDate(new_from_date) const to = toDate(new_to_date) const now = new Date() if (!from || from > now) return null if (to && to < now) return null return ( New ) }