<commit_before>import dates from './dates'

const getDstOffset = (start, end) =>
  Math.abs(start.getTimezoneOffset() - end.getTimezoneOffset())

const getKey = (min, max, step, slots) =>
  `${+dates.startOf(min, 'minutes')}` +
  `${+dates.startOf(max, 'minutes')}` +
  `${step}-${slots}`

export function getSlotMetrics({ min: start, max: end, step, timeslots }) {
  const key = getKey(start, end, step, timeslots)

  const totalMin = dates.diff(start, end, 'minutes') + getDstOffset(start, end)
  const minutesFromMidnight = dates.diff(
    dates.startOf(start, 'day'),
    start,
    'minutes'
  )<commit_msg>fix: totalMin calculation in TimeSlots. (#965)<commit_after>import dates from './dates'

const getDstOffset = (start, end) =>
  Math.abs(start.getTimezoneOffset() - end.getTimezoneOffset())

const getKey = (min, max, step, slots) =>
  `${+dates.startOf(min, 'minutes')}` +
  `${+dates.startOf(max, 'minutes')}` +
  `${step}-${slots}`

export function getSlotMetrics({ min: start, max: end, step, timeslots }) {
  const key = getKey(start, end, step, timeslots)

  const totalMin =
    1 + dates.diff(start, end, 'minutes') + getDstOffset(start, end)
  const minutesFromMidnight = dates.diff(
    dates.startOf(start, 'day'),
    start,
    'minutes'
  )
{'fraction_non_alphanumeric': 0.17549407114624507, 'fraction_numerical': 0.0031620553359683794, 'mean_word_length': 4.577092511013216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2062143', 'n_tokens_mistral': 452, 'n_tokens_neox': 449, 'n_words': 106}