"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
  const _easycom_hs_cell2 = common_vendor.resolveComponent("hs-cell");
  _easycom_hs_cell2();
}
const _easycom_hs_cell = () => "../hs-cell/hs-cell.js";
if (!Math) {
  _easycom_hs_cell();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "hs-date-picker",
  props: [
    "valueModel",
    "required",
    "tip",
    "title",
    "hasFutureDate",
    "borderTop",
    "isLink",
    "mode"
  ],
  emits: ["change", "update:valueModel"],
  setup(__props, { emit }) {
    const props = __props;
    const dateValue = common_vendor.ref("");
    const startDate = common_vendor.ref("");
    const endDate = common_vendor.ref("");
    const onChange = (e) => {
      dateValue.value = e == null ? void 0 : e.detail.value;
      emit("update:valueModel", e == null ? void 0 : e.detail.value);
      emit("change", e == null ? void 0 : e.detail.value);
    };
    common_vendor.onMounted(() => {
      const date = new Date();
      let year = date.getFullYear();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      month = month > 9 ? month : "0" + month;
      day = day > 9 ? day : "0" + day;
      startDate.value = (props == null ? void 0 : props.hasFutureDate) ? `${year}-${month}-${day}` : `${year - 60}-${month}-${day}`;
      endDate.value = `${year + 60}-${month}-${day}`;
      if (props == null ? void 0 : props.valueModel) {
        dateValue.value = props == null ? void 0 : props.valueModel;
      }
    });
    common_vendor.watch(
      () => props == null ? void 0 : props.valueModel,
      (newVal) => {
        console.log(newVal, "newVal");
        dateValue.value = props == null ? void 0 : props.valueModel;
      }
    );
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          title: (props == null ? void 0 : props.title) || "选择日期",
          required: props == null ? void 0 : props.required,
          borderTop: props == null ? void 0 : props.borderTop,
          value: dateValue.value,
          isLink: true,
          isLabelRight: true,
          isPlaceholder: "请选择日期"
        }),
        b: (props == null ? void 0 : props.mode) || "date",
        c: props.valueModel,
        d: common_vendor.o(onChange),
        e: startDate.value,
        f: endDate.value
      };
    };
  }
});
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-employee/src/components/hs-date-picker/hs-date-picker.vue"]]);
wx.createComponent(Component);
