fix: Set TZ to UTC
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"knex": "^2.5.1",
|
||||
"minio": "^8.0.1",
|
||||
"moment": "^2.30.1",
|
||||
"mongodb-core": "^3.2.7",
|
||||
"mongoose": "^7.5.4",
|
||||
"morgan": "^1.10.0",
|
||||
|
||||
@@ -313,6 +313,7 @@ function normalizeDatesFromData( data ){
|
||||
];
|
||||
for( const item of fields2normalize ){
|
||||
if( Object.hasOwn( data, item ) ){
|
||||
console.log( item )
|
||||
data[ item ] = normalizeDate( data[ item ] )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
}
|
||||
},
|
||||
"version" : {
|
||||
"version" : "1.5.9",
|
||||
"version" : "1.5.10",
|
||||
"name": "ETA Beta",
|
||||
"date":"22/07/2025"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
require('dotenv').config();
|
||||
const { ROOT_PATH, LIB_PATH, API_CONFIG } = process.env;
|
||||
process.env.TZ='utc';
|
||||
|
||||
const apiConfig = require( `${ROOT_PATH}/${API_CONFIG}` );
|
||||
const apps = require('./apps');
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"use strict";
|
||||
const apiConfig = require( '../config/apiConfig.json' );
|
||||
const crypto = require('crypto');
|
||||
const moment = require('moment');
|
||||
|
||||
const { S3Client, GetObjectCommand } = require('@aws-sdk/client-s3');
|
||||
const s3Client = new S3Client({
|
||||
@@ -44,13 +45,15 @@ function genKey( len = 6, key="" ){
|
||||
* @param {*} date
|
||||
*/
|
||||
function normalizeDate( date ){
|
||||
let in_date = new Date( date );
|
||||
let year = in_date.getFullYear();
|
||||
let monthIndex = in_date.getMonth();
|
||||
let day = in_date.getDate();
|
||||
// new Date(year, monthIndex, day, hours, minutes, seconds, milliseconds);
|
||||
// return new Date( year, monthIndex, day, 0, 0, 0, 0 );
|
||||
return new Date( Date.UTC( year, monthIndex, day, 0, 0, 0, 0 ) );
|
||||
process.env.TZ='utc';
|
||||
let in_date = moment( date, 'YYYY/MM/DD' );
|
||||
let year = in_date.get('year');
|
||||
let monthIndex = in_date.get('month');
|
||||
let day = in_date.get('date');
|
||||
let normalized_date = new Date( year, monthIndex, day, 0, 0, 0, 0 ).toISOString();
|
||||
// let normalized_date = moment( in_date, 'YYYY/MM/DD' ).toISOString();
|
||||
console.log( `${date} -> ${normalized_date}` );
|
||||
return normalized_date;
|
||||
}
|
||||
|
||||
function getPagination( query ){
|
||||
|
||||
Reference in New Issue
Block a user