Display timestamps in CSV as ISO string
This commit is contained in:
1 parent
405f9d6a0f
commit
97ed9797c5
1 file changed
+5
-5
+5
-5
@@ -118,16 +118,16 @@ router.get(`/devices/:id.csv`, async (ctx) => {
|
|||||||
const row = [
|
const row = [
|
||||||
k,
|
k,
|
||||||
p.object,
|
p.object,
|
||||||
p.objectTimestamp,
|
new Date(p.objectTimestamp).toJSON(),
|
||||||
p.writable,
|
p.writable,
|
||||||
p.writableTimestamp,
|
new Date(p.writableTimestamp).toJSON(),
|
||||||
`"${value.toString().replace(/"/g, '""')}"`,
|
`"${value.toString().replace(/"/g, '""')}"`,
|
||||||
type,
|
type,
|
||||||
p.valueTimestamp,
|
new Date(p.valueTimestamp).toJSON(),
|
||||||
p.notification,
|
p.notification,
|
||||||
p.notificationTimestamp,
|
new Date(p.notificationTimestamp).toJSON(),
|
||||||
p.accessList ? p.accessList.join(", ") : "",
|
p.accessList ? p.accessList.join(", ") : "",
|
||||||
p.accessListTimestamp,
|
new Date(p.accessListTimestamp).toJSON(),
|
||||||
];
|
];
|
||||||
ctx.body.write(row.map((r) => (r != null ? r : "")).join(",") + "\n");
|
ctx.body.write(row.map((r) => (r != null ? r : "")).join(",") + "\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user