@raystack/apsara 0.20.2 → 0.20.3

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.js CHANGED
@@ -28208,7 +28208,7 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28208
28208
  }
28209
28209
  else {
28210
28210
  registerEventListeners();
28211
- setTimeout(() => textFieldRef.current?.focus());
28211
+ setTimeout(() => textFieldRef.current?.select());
28212
28212
  }
28213
28213
  }
28214
28214
  function handleKeyUp(event) {
@@ -28220,7 +28220,9 @@ function DatePicker({ side = "top", dateFormat = "DD/MM/YYYY", placeholder = "DD
28220
28220
  function handleInputChange(event) {
28221
28221
  const { value } = event.target;
28222
28222
  const format = value.includes("/") ? "DD/MM/YYYY" : value.includes("-") ? "DD-MM-YYYY" : undefined;
28223
- const date = dayjs(value, format);
28223
+ const date = dayjs(value.replace(/(\d{1,2})\/(\d{1,2})\/(\d{4})/, (_, day, month, year) => {
28224
+ return `${day.padStart(2, '0')}/${month.padStart(2, '0')}/${year}`; // Replaces [8/8/2024] to [08/08/2024]
28225
+ }), format);
28224
28226
  const isValidDate = date.isValid();
28225
28227
  const isAfter = calendarProps?.startMonth !== undefined ? dayjs(date).isSameOrAfter(calendarProps.startMonth) : true;
28226
28228
  const isBefore = calendarProps?.endMonth !== undefined ? dayjs(date).isSameOrBefore(calendarProps.endMonth) : true;