Display timestamps in CSV as ISO string

This commit is contained in:
Zaid Abdulla committed 2021-02-01 13:02:42 -08:00
1 parent 405f9d6a0f
commit 97ed9797c5
1 file changed
+5 -5
+5 -5
View File
@@ -118,16 +118,16 @@ router.get(`/devices/:id.csv`, async (ctx) => {
const row = [
k,
p.object,
p.objectTimestamp,
new Date(p.objectTimestamp).toJSON(),
p.writable,
p.writableTimestamp,
new Date(p.writableTimestamp).toJSON(),
`"${value.toString().replace(/"/g, '""')}"`,
type,
p.valueTimestamp,
new Date(p.valueTimestamp).toJSON(),
p.notification,
p.notificationTimestamp,
new Date(p.notificationTimestamp).toJSON(),
p.accessList ? p.accessList.join(", ") : "",
p.accessListTimestamp,
new Date(p.accessListTimestamp).toJSON(),
];
ctx.body.write(row.map((r) => (r != null ? r : "")).join(",") + "\n");
}