Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
Fixed and changed Date saving on DB
Browse files Browse the repository at this point in the history
  • Loading branch information
Aggelos Vogiatzis authored and Aggelos Vogiatzis committed Aug 11, 2021
1 parent 226e889 commit aff9439
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ function checkForTable(event) {

function sendDatatoDB(values) {
if (toggleInsert) {
let now = new Date();
let date = new Date();
// console.log(values);
db('values').insert(
{
Expand Down Expand Up @@ -647,7 +647,8 @@ function sendDatatoDB(values) {
SUNENERGY: values.SUNENERGY,
SUNENERGYG1: values.SUNENERGYG1,
SUNENERGYG2: values.SUNENERGYG2,
DATE: now.format("dd/MM/yyyy HH:mm:ss l"),
DATE: date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear(),
TIME: date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() + '-' + date.getMilliseconds(),
}
).then(() => console.log('Inserted'))
.catch((err) => { console.log(err); throw err; });
Expand Down

0 comments on commit aff9439

Please sign in to comment.