Skip to content

Commit

Permalink
DateTime bug fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepreddy792 committed Nov 19, 2024
1 parent bf83727 commit c5456d2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM node:23-alpine

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
COPY package*.json ./
COPY --chown=node:node package*.json ./

USER node

Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"name": "SubmissionsTrackingDBAPI",
"version": "0.1.0",
"dependencies": {
"express": "4.12.x",
"body-parser": "1.17.1",
"csvtojson": "0.5.14",
"dateformat": "2.0.0",
"mysql": "2.13.0",
"fs": "0.0.2",
"express": "4.21.1",
"body-parser": "1.20.3",
"csvtojson": "2.0.10",
"mysql": "2.18.1",
"yamljs": "0.3.0",
"dotenv": "10.0.0"
"dotenv": "16.4.5",
"date-fns-tz": "3.2.0"
}
}
17 changes: 8 additions & 9 deletions sbRestApiServer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Based on https://github.com/sbalagop/neo/blob/master/nserver.js
var express = require('express');
var fs = require('fs');
import express from 'express';
import bodyParser from 'body-parser';
import mysql from 'mysql';
import { formatInTimeZone } from 'date-fns-tz';
import yamljs from 'yamljs';
import dotenv from 'dotenv';

var app = express();
var bodyParser = require('body-parser');
var mysql = require('mysql');
var dateFormat = require('dateformat');
var yamljs = require('yamljs');
const dotenv = require('dotenv');
dotenv.config();

// Serve static files in 'ui' subdirectory of the directory in which this server is being run (i.e. the Submissions Tracking DB Home page)
Expand Down Expand Up @@ -126,8 +126,7 @@ function returnResults(res, err, results, format, tsvFields) {
tsvFields.forEach(function(entry) {
var val = result[entry];
if (entry == "date_last_processed") { // i.e. entry.startsWith("date")
// Note that dates in DB are always GMT - hence are incorrect during BST period - hence the adjustment below
var dateTimeInCurrentTimeZone = dateFormat(new Date(result[entry]),'yyyy-mm-dd HH:MM');
var dateTimeInCurrentTimeZone = formatInTimeZone(new Date(result[entry]), "Europe/London", 'yyyy-MM-dd HH:mm');
row.push(dateTimeInCurrentTimeZone);
} else if (entry === "nextflow_run_id") {
if(result[entry] != null && result[entry] != undefined){
Expand Down

0 comments on commit c5456d2

Please sign in to comment.