<commit_before>/* eslint-disable no-undef */
const getIcon = (format) => {
  /* eslint-disable no-unused-vars */
  let icon = 'fa fa-calendar'
  if (typeof format === 'string') {
    if (hasDate(format) && hasTime(format)) {
      icon = 'fa fa-calendar'
    } else if (hasDate(format)) {
      icon = 'fa fa-calendar-o'
    } else if (hasTime(format)) {
      icon = 'fa fa-clock-o'
    }
  }
  return icon
}

const hasDate = (format) => {
  let characters = ['Y', 'S', 'd', 'M']
  return hasCharacters(format, characters)
}

const hasTime = (format) => {
  let characters = ['H', 'h', 'k', 'm', 'S', 's']
  return hasCharacters(format, characters)
}

const hasCharacters = (format, characters) => {
  let regx = new RegExp('[' + characters.join('') + ']', 'g')
  let regxResult = format.match(regx)
  if (regxResult) {
    return regxResult.length > 0
  }
  return false
}

const getOptions = (self) => {
  self.id = self._uid
  let format = 'YYYY-MM-DD HH:mm:ss'
  const options = {
    format: format,
    icons: {
      date: self.getIcon(self.dataOptions.format || format)
    }
  }
  return Object.assign({}, options, self.dataOptions)
}

const initDatetimepicker = (self) => {
  $('#date_time_' + self.id).datetimepicker(self.options)
}

const destroyDatetimepicker = (self) => {
  try {
    $(self.$el).find('#date_time_' + self.id).data('DateTimePicker').destroy()
    self.unwatch()
  } catch (ex) {}
}

export default {
  methods: {
    getIcon: getIcon,
    hasDate: hasDate,
    hasTime: hasTime,
    hasCharacters: hasCharacters,<commit_msg>Bug fix(Datetimepicker): Added Datetimepicker clear val<commit_after>/* eslint-disable no-undef */
const getIcon = (format) => {
  /* eslint-disable no-unused-vars */
  let icon = 'fa fa-calendar'
  if (typeof format === 'string') {
    if (hasDate(format) && hasTime(format)) {
      icon = 'fa fa-calendar'
    } else if (hasDate(format)) {
      icon = 'fa fa-calendar-o'
    } else if (hasTime(format)) {
      icon = 'fa fa-clock-o'
    }
  }
  return icon
}

const hasDate = (format) => {
  let characters = ['Y', 'S', 'd', 'M']
  return hasCharacters(format, characters)
}

const hasTime = (format) => {
  let characters = ['H', 'h', 'k', 'm', 'S', 's']
  return hasCharacters(format, characters)
}

const hasCharacters = (format, characters) => {
  let regx = new RegExp('[' + characters.join('') + ']', 'g')
  let regxResult = format.match(regx)
  if (regxResult) {
    return regxResult.length > 0
  }
  return false
}

const getOptions = (self) => {
  self.id = self._uid
  let format = 'YYYY-MM-DD HH:mm:ss'
  const options = {
    format: format,
    icons: {
      date: self.getIcon(self.dataOptions.format || format)
    }
  }
  return Object.assign({}, options, self.dataOptions)
}

const initDatetimepicker = (self) => {
  $('#date_time_' + self.id).datetimepicker(self.options)
}

const destroyDatetimepicker = (self) => {
  try {
    $(self.$el).find('#date_time_' + self.id).val('')
    $(self.$el).find('#date_time_' + self.id).data('DateTimePicker').destroy()
    self.unwatch()
  } catch (ex) {}
}

export default {
  methods: {
    getIcon: getIcon,
    hasDate: hasDate,
    hasTime: hasTime,
    hasCharacters: hasCharacters,
{'fraction_non_alphanumeric': 0.17549875311720697, 'fraction_numerical': 0.0006234413965087282, 'mean_word_length': 3.2843791722296394, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '3685421', 'n_tokens_mistral': 1143, 'n_tokens_neox': 1140, 'n_words': 262}