<commit_before>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

import TileGroup from '../TileGroup';
import Day from './Day';

import {
  getDayOfWeek,
  getDaysInMonth,
  getMonthIndex,
  getYear,
} from '../shared/dates';
import { isCalendarType, tileGroupProps } from '../shared/propTypes';

export default class Days extends PureComponent {
  get offset() {
    const { showFixedNumberOfWeeks, showNeighboringMonth } = this.props;

    if (showFixedNumberOfWeeks || showNeighboringMonth) {
      return 0;
    }

    const { activeStartDate, calendarType } = this.props;

    return getDayOfWeek(activeStartDate, calendarType);
  }

  /**
   * Defines on which day of the month the grid shall start. If we simply show current
   * month, we obviously start on day one, but if showNeighboringMonth is set to
   * true, we need to find the beginning of the week the first day of the month is in.
   */
  get start() {
    const { showFixedNumberOfWeeks, showNeighboringMonth } = this.props;

    if (showFixedNumberOfWeeks || showNeighboringMonth) {
      const { activeStartDate, calendarType } = this.props;
      return -getDayOfWeek(activeStartDate, calendarType) + 1;
    }

    return 1;
  }

  /**
   * Defines on which day of the month the grid shall end. If we simply show current
   * month, we need to stop on the last day of the month, but if showNeighboringMonth
   * is set to true, we need to find the end of the week the last day of the month is in.
   */
  get end() {
    const { activeStartDate, showFixedNumberOfWeeks, showNeighboringMonth } = this.props;
    const daysInMonth = getDaysInMonth(activeStartDate);

    if (showFixedNumberOfWeeks) {
      // Always show 6 weeks
      return this.start + (6 * 7) - 1;
    }

    if (showNeighboringMonth) {
      const { year, monthIndex } = this;
      const { calendarType } = this.props;
      const activeEndDate = new Date(year, monthIndex, daysInMonth);
      return daysInMonth + (7 - getDayOfWeek(activeEndDate, calendarType) - 1);
    }

    return daysInMonth;
  }

  get year() {
    const { activeStartDate } = this.props;
    return getYear(activeStartDate);
  }

  get monthIndex() {
    const { activeStartDate } = this.props;
    return getMonthIndex(activeStartDate);
  }

  render() {
    const { monthIndex } = this;

    const {
      showNeighboringMonth,
      ...otherProps
    } = this.props;
<commit_msg>Exclude showFixedNumberOfWeeks from TileGroup component props<commit_after>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';

import TileGroup from '../TileGroup';
import Day from './Day';

import {
  getDayOfWeek,
  getDaysInMonth,
  getMonthIndex,
  getYear,
} from '../shared/dates';
import { isCalendarType, tileGroupProps } from '../shared/propTypes';

export default class Days extends PureComponent {
  get offset() {
    const { showFixedNumberOfWeeks, showNeighboringMonth } = this.props;

    if (showFixedNumberOfWeeks || showNeighboringMonth) {
      return 0;
    }

    const { activeStartDate, calendarType } = this.props;

    return getDayOfWeek(activeStartDate, calendarType);
  }

  /**
   * Defines on which day of the month the grid shall start. If we simply show current
   * month, we obviously start on day one, but if showNeighboringMonth is set to
   * true, we need to find the beginning of the week the first day of the month is in.
   */
  get start() {
    const { showFixedNumberOfWeeks, showNeighboringMonth } = this.props;

    if (showFixedNumberOfWeeks || showNeighboringMonth) {
      const { activeStartDate, calendarType } = this.props;
      return -getDayOfWeek(activeStartDate, calendarType) + 1;
    }

    return 1;
  }

  /**
   * Defines on which day of the month the grid shall end. If we simply show current
   * month, we need to stop on the last day of the month, but if showNeighboringMonth
   * is set to true, we need to find the end of the week the last day of the month is in.
   */
  get end() {
    const { activeStartDate, showFixedNumberOfWeeks, showNeighboringMonth } = this.props;
    const daysInMonth = getDaysInMonth(activeStartDate);

    if (showFixedNumberOfWeeks) {
      // Always show 6 weeks
      return this.start + (6 * 7) - 1;
    }

    if (showNeighboringMonth) {
      const { year, monthIndex } = this;
      const { calendarType } = this.props;
      const activeEndDate = new Date(year, monthIndex, daysInMonth);
      return daysInMonth + (7 - getDayOfWeek(activeEndDate, calendarType) - 1);
    }

    return daysInMonth;
  }

  get year() {
    const { activeStartDate } = this.props;
    return getYear(activeStartDate);
  }

  get monthIndex() {
    const { activeStartDate } = this.props;
    return getMonthIndex(activeStartDate);
  }

  render() {
    const { monthIndex } = this;

    const {
      showFixedNumberOfWeeks,
      showNeighboringMonth,
      ...otherProps
    } = this.props;

{'fraction_non_alphanumeric': 0.09239789729074, 'fraction_numerical': 0.003639304488475536, 'mean_word_length': 3.1328320802005014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4974356', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1472, 'n_words': 480}