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