From 902f2eb42860cf4fbf3a326d1945aff22b813542 Mon Sep 17 00:00:00 2001 From: Oscar Martinez Date: Mon, 15 Jun 2020 20:02:19 -0500 Subject: [PATCH] Fix date validation in startup and grow api plans --- .gitignore | 1 + interfaz.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 9499476..770c2df 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /proyectsReceipts package-lock.json .env +.directory diff --git a/interfaz.js b/interfaz.js index 33ff1d4..3f767eb 100644 --- a/interfaz.js +++ b/interfaz.js @@ -7,7 +7,7 @@ let hasher = require('node-object-hash') const fs = require('fs'); const path = require('path'); -const addressDB = '/orbitdb/zdpuAykPJ4qtBg2toS2vxr5eaPfGEBJmvGerM7V7x8qn5c8hW/decaCCDB'; +const addressDB = 'decaCCDB'; //A instance of ipfs locally in ipfs daemon const ipfs = IpfsClient('http://localhost:5001'); @@ -213,8 +213,8 @@ const main = async () => { if(date.isValid() && moment.utc() >= date) { if(insertMenu != 'cancelDate') carbonCredit[insertMenu] = date.format('DD-MM-YYYY HH:mm Z'); else if((date >= moment.utc().subtract(3, 'months') && process.env.APIMODE == 'dev') || - (date >= moment.utc().subtract(1, 'year') && process.env.APIMODE == 'startup') || - (date >= moment.utc().subtract(7, 'year') && process.env.APIMODE == 'grow')) { + (date >= moment.utc().subtract(1, 'years') && process.env.APIMODE == 'startup') || + (date >= moment.utc().subtract(7, 'years') && process.env.APIMODE == 'grow')) { carbonCredit[insertMenu] = date.format('DD-MM-YYYY HH:mm Z'); } else console.error(' Date is too old to get pricing data'); } else console.error(' Date must follow next syntax: dd-mm-yyyy hh-mm and can\'t be in the future');