<script>
//////////////////////////////////////////
//  GZTimePicker
// This component was created to wrap the
// vuetify time picker to allow using string date
// and time in iso format and not lose the date
// portion when picking a new time
//2019-02-12T10:12:39.594206
/*  eslint-disable */
export default {
  props: {
    value: {
      type: String,
      default: ""
    }
  },
  render() {
    var that = this;
    return this.$createElement("v-time-picker", {
      props: {
        ...this.$attrs,
        value: this.value ? this.value.substr(11,8) : null
      },
      on: {
        ...this.$listeners,
        input: function(time) {
         // debugger;
          //Put back the time portion from before
          console.log("gztimepicker, on input, time is: " + time);
          var combined = that.value.substr(0, 11) + time;
          console.log("gztimepicker, on input, COMBINED (STRING) time is: " + combined);
          var theNewDate=new Date(Date.UTC(combined)).toISOString();
          console.log("gztimepicker, on input, COMBINED (ISODATE CONVERTED)is: " + combined);

          that.$emit("input",theNewDate);
         
        }
      }
    });
  }
};
</script>
