<commit_before>class Lale.DateTime
  constructor: (date_field, time_field)->
    # after init, the input element is still empty, 
    # but the datepicker getValue call already returns a valid date object
    @dateFilled = date_field.val() != ''
    @value = this.buildDate(date_field, time_field)

  buildDate: (date_field, time_field)->
    date = this.parseDate(date_field)
    time = this.parseTime(time_field)
    date.setHours(time['hours'])
    date.setMinutes(time['minutes'])
    date

  valid:->
    @dateFilled && (@value instanceof Date)

  parseDate: (field)->
    field.datetimepicker('getValue')

  parseTime: (field)->
    if field.val()
      parts = field.val().split(":")
      h = parseInt(parts[0])
      m = parseInt(parts[1])
    else
      h = 0
      m = 0
    { hours: h, minutes: m }

ready = ->
<commit_msg>task form: fix JS Error on start date<commit_after>class Lale.DateTime
  constructor: (date_field, time_field)->
    # after init, the input element is still empty, 
    # but the datepicker getValue call can already return a valid date object
    @dateFilled = date_field.val() != ''
    @value = this.buildDate(date_field, time_field)

  buildDate: (date_field, time_field)->
    date = this.parseDate(date_field)
    if date
      time = this.parseTime(time_field)
      date.setHours(time['hours'])
      date.setMinutes(time['minutes'])
      date
    else
      null

  valid:->
    @dateFilled && (@value instanceof Date)

  parseDate: (field)->
    field.datetimepicker('getValue')

  parseTime: (field)->
    if field.val()
      parts = field.val().split(":")
      h = parseInt(parts[0])
      m = parseInt(parts[1])
    else
      h = 0
      m = 0
    { hours: h, minutes: m }

ready = ->

{'fraction_non_alphanumeric': 0.1318364997121474, 'fraction_numerical': 0.004605641911341394, 'mean_word_length': 2.9232505643340856, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 15, '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': '4039298', 'n_tokens_mistral': 570, 'n_tokens_neox': 555, 'n_words': 146}