<commit_before>import React from 'react'

import styles from './event-heading.module.styl'

export default class EventHeading extends React.Component {
  constructor (props) {
    super(props)

    const date = new Date(props.event.date * 1000)

    this.state = {
      dateDate: formatDate(date),
      dateTime: formatTime(date),
      eventName: `${props.event.home} X ${props.event.away}`
    }
  }

  render () {
    const event = this.props.event

    return (
      <h4>
        <span className={styles.red}>{event.code}</span>
        {
          ` - ${this.state.dateDate}, ${this.state.dateTime}
          - ${this.state.eventName}
          - ${event.sport}
          - ${event.country}
          - ${event.competition}`
        }
      </h4>
    )
  }
}

function formatDate (date) {
  const now = new Date()<commit_msg>Refactor component: - remove unnecessary use of state; - create auxiliary variables in the render function.<commit_after>import React from 'react'

import styles from './event-heading.module.styl'

export default function EventHeading (props) {
  const {
    event
  } = props
  const date = new Date(event.date * 1000)

  const dateDate = formatDate(date)
  const dateTime = formatTime(date)
  const eventName = `${event.home} X ${event.away}`

  return (
    <h4>
      <span className={styles.red}>{event.code}</span>
      {
        ` - ${dateDate}, ${dateTime}
        - ${eventName}
        - ${event.sport}
        - ${event.country}
        - ${event.competition}`
      }
    </h4>
  )
}

function formatDate (date) {
  const now = new Date()
{'fraction_non_alphanumeric': 0.1407828282828283, 'fraction_numerical': 0.007575757575757576, 'mean_word_length': 2.430735930735931, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '338521', 'n_tokens_mistral': 506, 'n_tokens_neox': 496, 'n_words': 115}