@bytebrand/export-cars 1.22.24 → 1.22.25
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/package.json
CHANGED
|
@@ -540,12 +540,14 @@ export class GoogleTransformer {
|
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
private getYear(car: DataSchemes.Car): number {
|
|
543
|
-
// mainData.firstModelsProductionDate
|
|
544
|
-
//
|
|
545
|
-
//
|
|
546
|
-
//
|
|
543
|
+
// mainData.firstModelsProductionDate is already a 4-digit year (mobile.de "vintage").
|
|
544
|
+
// constructionYear/firstRegistration/metaData.creationDate are unix timestamps in
|
|
545
|
+
// seconds (constructionYear is stored via legacy dateToUnix, not a bare year — see
|
|
546
|
+
// services/scrapper/src/ai/car-bridge.ts:174). Not every car has firstModelsProductionDate
|
|
547
|
+
// (e.g. dealer FTP imports), so fall through to other date sources — `year` is a
|
|
548
|
+
// mandatory Google feed field.
|
|
547
549
|
const firstModelsProductionYear = toSafeInteger(get(car, 'mainData.firstModelsProductionDate', 0));
|
|
548
|
-
const constructionYear =
|
|
550
|
+
const constructionYear = new Date(+get(car, 'mainData.constructionYear', 0) * 1000).getUTCFullYear();
|
|
549
551
|
const firstRegistrationYear = new Date(+get(car, 'mainData.firstRegistration', 0) * 1000).getUTCFullYear();
|
|
550
552
|
const metaCreationYear = new Date(+get(car, 'metaData.creationDate', 0) * 1000).getUTCFullYear();
|
|
551
553
|
const currentYear = new Date().getUTCFullYear();
|