Skip to content

Commit

Permalink
fix(hiringcafe): correct pubDate parsing (#18004)
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
mintyfrankie authored Dec 30, 2024
1 parent 6233163 commit 74ea8f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/routes/hiring.cafe/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 74ea8f5

Please sign in to comment.