Closed snehaos closed 5 months ago
Please try this code
server.post("/clock-in", async (req, res) => { try {
const currentTime = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kathmandu' });
const query = "INSERT INTO attendance (clock_in) VALUES ($1)";
const values = [currentTime];
await client.query(query, values);
console.log("Clock-in time inserted successfully");
res.sendStatus(200);
} catch (error) {
console.error("Error inserting clock-in time:", error);
res.sendStatus(500);
}
});
A bug was found in "clock-in" of attendance even if there is error in database it sends a successful message. The clock in logic `server.post("/clock-in", async (req, res) => { try { const currentTime = new Date().toLocaleString('en-US', { timeZone: 'Asia/Kathmandu' });
});`