fix(hiringcafe): correct pubDate parsing (#18004)
- Introduced `estimated_publish_date_millis` to `ProcessedJobData` interface. - Removed the old `estimated_publish_date` from `JobResult` interface. - Updated `transformJobItem` function to use the new `estimated_publish_date_millis` for publication date formatting. Signed-off-by: mintyfrankie <77310871+mintyfrankie@users.noreply.github.com>
This commit is contained in:
@@ -39,6 +39,7 @@ interface ProcessedJobData {
|
||||
readonly job_category: string;
|
||||
readonly role_activities: readonly string[];
|
||||
readonly formatted_workplace_location?: string;
|
||||
readonly estimated_publish_date_millis: string;
|
||||
}
|
||||
|
||||
interface JobResult {
|
||||
@@ -47,7 +48,6 @@ interface JobResult {
|
||||
readonly job_information: JobInformation;
|
||||
readonly v5_processed_job_data: ProcessedJobData;
|
||||
readonly _geoloc: readonly GeoLocation[];
|
||||
readonly estimated_publish_date: string;
|
||||
}
|
||||
|
||||
interface ApiResponse {
|
||||
@@ -96,13 +96,13 @@ const renderJobDescription = (jobInfo: JobInformation, processedData: ProcessedJ
|
||||
});
|
||||
|
||||
const transformJobItem = (item: JobResult) => {
|
||||
const { job_information: jobInfo, v5_processed_job_data: processedData, estimated_publish_date, apply_url, id } = item;
|
||||
const { job_information: jobInfo, v5_processed_job_data: processedData, apply_url, id } = item;
|
||||
|
||||
return {
|
||||
title: `${jobInfo.title} - ${processedData.company_name}`,
|
||||
description: renderJobDescription(jobInfo, processedData),
|
||||
link: apply_url,
|
||||
pubDate: new Date(estimated_publish_date).toUTCString(),
|
||||
pubDate: new Date(processedData.estimated_publish_date_millis).toUTCString(),
|
||||
category: [processedData.job_category, ...processedData.role_activities, processedData.workplace_type].filter((x): x is string => !!x),
|
||||
author: processedData.company_name,
|
||||
guid: id,
|
||||
|
||||
Reference in New Issue
Block a user