@propeller-commerce/propeller-v2-react-ui 0.4.21 → 0.4.22
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8448,12 +8448,15 @@ function DeliveryDate(props) {
|
|
|
8448
8448
|
if (props.initialDate && !selectedDate) {
|
|
8449
8449
|
const dot = props.initialDate.lastIndexOf(".");
|
|
8450
8450
|
const normalized = dot !== -1 ? props.initialDate.substring(0, dot) + "Z" : props.initialDate;
|
|
8451
|
-
|
|
8451
|
+
const parsed = new Date(normalized);
|
|
8452
|
+
const isWeekend = !isNaN(parsed.getTime()) && (parsed.getDay() === 0 || parsed.getDay() === 6);
|
|
8453
|
+
const adopt = skipWeekends && isWeekend && upcomingDates.length > 0 ? upcomingDates[0] : normalized;
|
|
8454
|
+
setSelectedDate(adopt);
|
|
8452
8455
|
if (props.onDateSelect) {
|
|
8453
|
-
props.onDateSelect(
|
|
8456
|
+
props.onDateSelect(adopt);
|
|
8454
8457
|
}
|
|
8455
8458
|
}
|
|
8456
|
-
}, [props.initialDate, props.cart, selectedDate, props.onDateSelect, props]);
|
|
8459
|
+
}, [props.initialDate, props.cart, selectedDate, props.onDateSelect, props, skipWeekends, upcomingDates]);
|
|
8457
8460
|
return /* @__PURE__ */ jsxs("div", { className: `propeller-delivery-date ${containerClass}`, children: [
|
|
8458
8461
|
/* @__PURE__ */ jsxs("div", { className: "propeller-delivery-date__grid grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-3", children: [
|
|
8459
8462
|
upcomingDates.map((dateStr, index) => {
|