@hoddy-ui/next 2.5.83 → 2.5.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1651,9 +1651,9 @@ var TextField = ({
1651
1651
  return /* @__PURE__ */ new Date();
1652
1652
  if (value instanceof Date)
1653
1653
  return value;
1654
- const parts = `${value}`.split("/");
1655
- if (parts.length === 3) {
1656
- const [day, month, year] = parts;
1654
+ const isoParts = `${value}`.split("-");
1655
+ if (isoParts.length === 3) {
1656
+ const [year, month, day] = isoParts;
1657
1657
  const parsed = new Date(
1658
1658
  parseInt(year, 10),
1659
1659
  parseInt(month, 10) - 1,
@@ -1666,10 +1666,10 @@ var TextField = ({
1666
1666
  return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1667
1667
  };
1668
1668
  const handleDateConfirm = (date) => {
1669
- const day = date.getDate();
1670
- const month = date.getMonth() + 1;
1671
1669
  const year = date.getFullYear();
1672
- const dateString = `${day}/${month}/${year}`;
1670
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
1671
+ const day = `${date.getDate()}`.padStart(2, "0");
1672
+ const dateString = `${year}-${month}-${day}`;
1673
1673
  onChangeText?.(dateString);
1674
1674
  setDatePickerVisible(false);
1675
1675
  };
@@ -1949,9 +1949,9 @@ var TextField2 = React15.forwardRef(
1949
1949
  return /* @__PURE__ */ new Date();
1950
1950
  if (value instanceof Date)
1951
1951
  return value;
1952
- const parts = `${value}`.split("/");
1953
- if (parts.length === 3) {
1954
- const [day, month, year] = parts;
1952
+ const isoParts = `${value}`.split("-");
1953
+ if (isoParts.length === 3) {
1954
+ const [year, month, day] = isoParts;
1955
1955
  const parsed = new Date(
1956
1956
  parseInt(year, 10),
1957
1957
  parseInt(month, 10) - 1,
@@ -1964,12 +1964,13 @@ var TextField2 = React15.forwardRef(
1964
1964
  return isNaN(fallback.getTime()) ? /* @__PURE__ */ new Date() : fallback;
1965
1965
  };
1966
1966
  const handleDateConfirm = (date) => {
1967
- const day = date.getDate();
1968
- const month = date.getMonth() + 1;
1969
1967
  const year = date.getFullYear();
1968
+ const month = `${date.getMonth() + 1}`.padStart(2, "0");
1969
+ const day = `${date.getDate()}`.padStart(2, "0");
1970
1970
  const dateString = `${year}-${month}-${day}`;
1971
1971
  onChangeText?.(dateString);
1972
1972
  setDatePickerVisible(false);
1973
+ setFocused(false);
1973
1974
  };
1974
1975
  const handleContainerPress = () => {
1975
1976
  if (disabled)
@@ -2072,19 +2073,7 @@ var TextField2 = React15.forwardRef(
2072
2073
  variant: "caption"
2073
2074
  },
2074
2075
  helperText
2075
- ), error && /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), isDate && /* @__PURE__ */ React15.createElement(
2076
- DateTimePickerModal,
2077
- {
2078
- isVisible: datePickerVisible,
2079
- mode: "date",
2080
- date: parseDateValue(),
2081
- onConfirm: handleDateConfirm,
2082
- onCancel: () => {
2083
- setDatePickerVisible(false);
2084
- setFocused(false);
2085
- }
2086
- }
2087
- ), options && /* @__PURE__ */ React15.createElement(
2076
+ ), error && /* @__PURE__ */ React15.createElement(View10, { style: styles.error }, /* @__PURE__ */ React15.createElement(MaterialIcons5, { name: "error", color: colors2.error.main, size: 16 }), /* @__PURE__ */ React15.createElement(Typography_default, { style: styles.errorText, color: "error" }, error))), options && /* @__PURE__ */ React15.createElement(
2088
2077
  SelectMenu_default,
2089
2078
  {
2090
2079
  options,
@@ -2096,6 +2085,18 @@ var TextField2 = React15.forwardRef(
2096
2085
  onChange: onChangeText,
2097
2086
  ...selectMenuProps
2098
2087
  }
2088
+ ), isDate && /* @__PURE__ */ React15.createElement(
2089
+ DateTimePickerModal,
2090
+ {
2091
+ isVisible: datePickerVisible,
2092
+ mode: "date",
2093
+ date: parseDateValue(),
2094
+ onConfirm: handleDateConfirm,
2095
+ onCancel: () => {
2096
+ setDatePickerVisible(false);
2097
+ setFocused(false);
2098
+ }
2099
+ }
2099
2100
  ));
2100
2101
  }
2101
2102
  );