import format from 'date-fns/format'

type prepareTimeFormat = {
  date: Date,
  isNeedFormatTimeChanged: boolean,
  time: string,
}

export const getPrepareTimeFormat = ({
  date,
  isNeedFormatTimeChanged,
  time,
}: prepareTimeFormat) => (
  isNeedFormatTimeChanged
    ? format(date, 'h:mm a')
    : time
)
