Skip to content

Commit

Permalink
Covert timestamps to human-readable date in csv export
Browse files Browse the repository at this point in the history
  • Loading branch information
kdow committed Jun 19, 2024
1 parent e3eddd9 commit f88cdf2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions components/main/Desktop/ExportButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,16 @@ function ExportButton({ filters }) {
const neighborhoodDataQuery = generateQuery();
const neighborhoodDataToExport = await conn.query(neighborhoodDataQuery);
const neighborhoodResults = ddbh.getTableData(neighborhoodDataToExport);

if (!isEmpty(neighborhoodResults)) {
const neighborhoodCsvContent = Papa.unparse(neighborhoodResults);
const formattedResults = neighborhoodResults.map(row => ({
...row,
CreatedDate: row.CreatedDate ? moment(row.CreatedDate).format('YYYY-MM-DD HH:mm:ss') : null,
UpdatedDate: row.UpdatedDate ? moment(row.UpdatedDate).format('YYYY-MM-DD HH:mm:ss') : null,
ServiceDate: row.ServiceDate ? moment(row.ServiceDate).format('YYYY-MM-DD HH:mm:ss') : null,
ClosedDate: row.ClosedDate ? moment(row.ClosedDate).format('YYYY-MM-DD HH:mm:ss') : null,
}));

if (!isEmpty(formattedResults)) {
const neighborhoodCsvContent = Papa.unparse(formattedResults);
let groupedAddressesToExport;
let srCountResults;
let srCsvContent;
Expand Down

0 comments on commit f88cdf2

Please sign in to comment.