import React, { useContext } from 'react'
import PropTypes from 'prop-types'
import { FormattedText } from '../../../../FormattedText'
import { ConfigureContext } from '../../../../../contex/configureContext/ConfigureContext'

interface Props {
  day: number
  month: number
}

export const TextDate = ({ day, month }: Props) => {

  const { configureState } = useContext(ConfigureContext)
  const { dateMonthFormat, dateDayFormat } = configureState.parameters

  return (
    <div style={{ display: 'flex', alignItems: 'center' }}>
      <FormattedText text={`${day}/`} format={dateDayFormat} />
      <FormattedText text={`${month + 1}`} format={dateMonthFormat} />
    </div>
  )
}

TextDate.propTypes = {
  day: PropTypes.number.isRequired,
  dayFormat: PropTypes.object,
  month: PropTypes.number.isRequired,
  monthFormat: PropTypes.object
}

