From 97ed9797c50e02aff602125ad90cd40d4c4e803a Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Mon, 1 Feb 2021 13:02:42 -0800 Subject: [PATCH] Display timestamps in CSV as ISO string --- lib/ui/api.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ui/api.ts b/lib/ui/api.ts index 1f755c9..e06c484 100644 --- a/lib/ui/api.ts +++ b/lib/ui/api.ts @@ -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"); }