fix: correct formatCentsToCurrency usage in facebook scraper

This commit is contained in:
2026-01-23 14:46:50 -05:00
parent 2f97d3eafd
commit df0c528535

View File

@@ -840,8 +840,7 @@ export function parseFacebookAds(
title, title,
listingPrice: { listingPrice: {
amountFormatted: amountFormatted:
priceObj.formatted_amount || priceObj.formatted_amount || formatCentsToCurrency(cents, "en-CA"),
formatCentsToCurrency(cents / 100, "en-CA"),
cents, cents,
currency: priceObj.currency || "CAD", // Facebook marketplace often uses CAD currency: priceObj.currency || "CAD", // Facebook marketplace often uses CAD
}, },
@@ -888,8 +887,7 @@ export function parseFacebookItem(
if (!Number.isNaN(amount)) { if (!Number.isNaN(amount)) {
cents = Math.round(amount * 100); cents = Math.round(amount * 100);
amountFormatted = amountFormatted =
item.formatted_price?.text || item.formatted_price?.text || formatCentsToCurrency(cents, "en-CA");
formatCentsToCurrency(cents / 100, "en-CA");
} }
} }
} }