(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";

Vue.component('date-picker', DatePicker["default"]);

Vue.component('wpcfto_date', {
    mixins: [window.validationMixin],
  props: ['fields', 'field_label', 'field_name', 'field_id', 'field_value', 'required'],
  data() {
    return {
      value: null,
      input_value: ''
    };
  },
  mounted() {
    if (typeof this.field_value !== 'undefined' && this.field_value !== '') {
      this.input_value = this.field_value;

      // If field_value is a timestamp (number or string), convert to Date
      const timestamp = Number(this.field_value);
      if (!isNaN(timestamp)) {
        this.value = new Date(timestamp);
      } else {
        // fallback: try to parse as date string
        this.value = new Date(this.field_value);
      }
    }
  },
  template: `
    <div class="wpcfto_generic_field wpcfto_generic_field_flex_input wpcfto_generic_field_date">
      <wpcfto_fields_aside_before 
        :fields="fields" 
        :field_label="field_label"
        :required="fields.required === true"
      ></wpcfto_fields_aside_before>

      <div class="wpcfto-field-content">
        <date-picker 
          v-model="value" 
          lang="en" 
          @change="dateChanged" 
          :required="fields.required === true"
        ></date-picker>

        <input type="hidden"
               :name="field_name"
               :id="field_id"
               v-model="input_value"
               :required="fields.required === true"
        />
      </div>

      <wpcfto_fields_aside_after :fields="fields"></wpcfto_fields_aside_after>
    </div>
  `,
  methods: {
    dateChanged(newDate) {
      // Convert date to Unix timestamp (milliseconds)
      // Normalize to UTC by creating a new Date with UTC components
      if (!newDate) {
        this.input_value = '';
        this.$emit('wpcfto-get-value', '');
        return;
      }

      // If newDate is a Date object, get time
      let unix_time;
      if (newDate instanceof Date) {
        unix_time = newDate.getTime();
      } else {
        // fallback: try to parse
        unix_time = new Date(newDate).getTime();
      }

      this.input_value = unix_time;
      this.$emit('wpcfto-get-value', unix_time);
    }
  }
});

//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZha2VfY2ZiNTEyZDMuanMiXSwibmFtZXMiOlsiVnVlIiwiY29tcG9uZW50IiwiRGF0ZVBpY2tlciIsInByb3BzIiwiZGF0YSIsInZhbHVlIiwiaW5wdXRfdmFsdWUiLCJtb3VudGVkIiwiZmllbGRfdmFsdWUiLCIkc2V0IiwiRGF0ZSIsInBhcnNlSW50IiwidGVtcGxhdGUiLCJtZXRob2RzIiwiZGF0ZUNoYW5nZWQiLCJuZXdEYXRlIiwidW5peF90aW1lIiwiZ2V0VGltZSIsIiRlbWl0Il0sIm1hcHBpbmdzIjoiQUFBQTs7QUFFQUEsR0FBRyxDQUFDQyxTQUFKLENBQWMsYUFBZCxFQUE2QkMsVUFBVSxDQUFDLFNBQUQsQ0FBdkM7QUFDQUYsR0FBRyxDQUFDQyxTQUFKLENBQWMsYUFBZCxFQUE2QjtBQUMzQkUsRUFBQUEsS0FBSyxFQUFFLENBQUMsUUFBRCxFQUFXLGFBQVgsRUFBMEIsWUFBMUIsRUFBd0MsVUFBeEMsRUFBb0QsYUFBcEQsQ0FEb0I7QUFFM0JDLEVBQUFBLElBQUksRUFBRSxTQUFTQSxJQUFULEdBQWdCO0FBQ3BCLFdBQU87QUFDTEMsTUFBQUEsS0FBSyxFQUFFLEVBREY7QUFFTEMsTUFBQUEsV0FBVyxFQUFFO0FBRlIsS0FBUDtBQUlELEdBUDBCO0FBUTNCQyxFQUFBQSxPQUFPLEVBQUUsU0FBU0EsT0FBVCxHQUFtQjtBQUMxQixTQUFLRixLQUFMLEdBQWEsS0FBS0csV0FBbEI7O0FBRUEsUUFBSSxPQUFPLEtBQUtBLFdBQVosS0FBNEIsV0FBaEMsRUFBNkM7QUFDM0MsV0FBS0MsSUFBTCxDQUFVLElBQVYsRUFBZ0IsYUFBaEIsRUFBK0IsS0FB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