From 5875d7bf1bf8ed5b3d3115f43f5f3ed995bde34b Mon Sep 17 00:00:00 2001 From: matt Date: Thu, 24 Feb 2022 23:04:59 +0000 Subject: [PATCH] Added new helper class to make insertion of dates easier into test data --- utility/db/dbTestData.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utility/db/dbTestData.js b/utility/db/dbTestData.js index b08720c..5e907ac 100644 --- a/utility/db/dbTestData.js +++ b/utility/db/dbTestData.js @@ -9,6 +9,18 @@ const path = require('path'); const DatabaseConnectionPool = require(path.join(__dirname, '../../lib/DatabaseConnectionPool')); +// Class for easy insertion of test dates into the database +class mySQLDate extends Date { + toString() { + return this.toISOString().slice(0, 19).replace('T', ' '); + } + + alterDays(amount) { + this.setDate(this.getDate() + amount); + return this; + } +} + // Object storing configurations for the db tables const tableDetails = { parent: {