@factorypure/client-helpers 1.0.6 → 1.0.8
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 +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { subDays } from "date-fns";
|
|
1
|
+
import { startOfDay, subDays } from "date-fns";
|
|
2
2
|
// @ts-ignore
|
|
3
3
|
import { Index } from "flexsearch";
|
|
4
4
|
// @ts-ignore
|
|
@@ -193,8 +193,8 @@ const filterLinkedElsewhereResults = (results, variantId) => {
|
|
|
193
193
|
parsedLinkedVariantIds = [];
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
const productLinkedElsewhere =
|
|
197
|
-
!
|
|
196
|
+
const productLinkedElsewhere = parsedLinkedVariantIds.length > 0 &&
|
|
197
|
+
!parsedLinkedVariantIds.includes(variantId);
|
|
198
198
|
if (productLinkedElsewhere) {
|
|
199
199
|
return false;
|
|
200
200
|
}
|
|
@@ -240,7 +240,7 @@ const filterDateWindow = (results, dayWindow) => {
|
|
|
240
240
|
if (!dayWindow)
|
|
241
241
|
return true;
|
|
242
242
|
const itemDate = new Date(item.created_at);
|
|
243
|
-
const variantDate = subDays(new Date(), Number(dayWindow) || 7);
|
|
243
|
+
const variantDate = startOfDay(subDays(new Date(), Number(dayWindow) || 7));
|
|
244
244
|
return itemDate >= variantDate;
|
|
245
245
|
});
|
|
246
246
|
return filtered;
|