Skip to content

Commit

Permalink
Update report-router.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
datajohnson committed Jun 3, 2024
1 parent f844c04 commit c2a2d92
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions api/src/routes/report-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ reportRouter.post("/", async (req: Request, res: Response) => {

let { createDate } = req.body;

console.log("CREATEDATE", createDate);
//console.log("CREATEDATE", createDate);

let dVal = DateTime.fromISO(createDate);

let formatted = dVal.toFormat("YYYY-MM-DD hh");
//let formatted = dVal.toFormat("YYYY-MM-DD hh");
console.log("FORMAT", dVal.toFormat("yyyy-MM-dd HH:mm:ss"));

//TIMESTAMP 'YYYY-MM-DD HH24:MI:SS.FF'

console.log(dVal);
console.log("ISO", dVal.toISO());
console.log("SQL", dVal.toSQL());
//console.log(dVal);
//console.log("ISO", dVal.toISO());
//console.log("SQL", dVal.toSQL());
//req.body.date = dVal.toISO();

req.body.createDate = dVal.toJSDate(); // knex.raw("TO_TIMESTAMP()")
req.body.createDate = knex.raw(`TO_TIMESTAMP("${dVal.toFormat("yyyy-MM-dd HH:mm:ss")}", "YYYY-MM-DD HH24:MI:SS")`);
delete req.body.date;

console.log("INSERTING REPORT", req.body);
Expand Down

0 comments on commit c2a2d92

Please sign in to comment.