From a7a8b10f8a14e62b592150c71adabfabe69c5692 Mon Sep 17 00:00:00 2001 From: Cesar Varela Date: Fri, 23 Aug 2024 18:38:34 -0300 Subject: [PATCH] Prevent CSV export from crashing on missing fields --- site/gatsby-site/src/components/discover/CsvExport.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/site/gatsby-site/src/components/discover/CsvExport.js b/site/gatsby-site/src/components/discover/CsvExport.js index 437516dbe0..3525f8f443 100644 --- a/site/gatsby-site/src/components/discover/CsvExport.js +++ b/site/gatsby-site/src/components/discover/CsvExport.js @@ -13,10 +13,10 @@ const convertData = (hits) => { 'incident id': hit.incident_id, 'report number': hit.report_number, title: hit.title, - 'date published': format(fromUnixTime(hit.epoch_date_published), 'yyyy-MM-dd'), - 'date submitted': format(fromUnixTime(hit.epoch_date_submitted), 'yyyy-MM-dd'), - 'date modified': format(fromUnixTime(hit.epoch_date_modified), 'yyyy-MM-dd'), - 'date downloaded': format(fromUnixTime(hit.epoch_date_downloaded), 'yyyy-MM-dd'), + 'date published': format(fromUnixTime(hit.epoch_date_published ?? 0), 'yyyy-MM-dd'), + 'date submitted': format(fromUnixTime(hit.epoch_date_submitted ?? 0), 'yyyy-MM-dd'), + 'date modified': format(fromUnixTime(hit.epoch_date_modified ?? 0), 'yyyy-MM-dd'), + 'date downloaded': format(fromUnixTime(hit.epoch_date_downloaded ?? 0), 'yyyy-MM-dd'), url: hit.url, 'source domain': hit.source_domain, language: hit.language,