Handle not available timezone in the exported csv
MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -857,11 +857,11 @@ export default class TransactionService {
csv += `${transaction.connectorId}` + Constants.CSV_SEPARATOR;
csv += `${transaction.user ? Cypher.hash(transaction.user.id) : ''}` + Constants.CSV_SEPARATOR;
csv += `${transaction.user ? Utils.buildUserFullName(transaction.user, false) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.timezone}` + Constants.CSV_SEPARATOR;
- csv += `${moment(transaction.timestamp).tz(transaction.timezone).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
- csv += `${moment(transaction.timestamp).tz(transaction.timezone).format('HH:mm:ss')}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? `${moment(transaction.stop.timestamp).tz(transaction.timezone).format('YYYY-MM-DD')}` : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? `${moment(transaction.stop.timestamp).tz(transaction.timezone).format('HH:mm:ss')}` : ''}` + Constants.CSV_SEPARATOR;
+ csv += `${transaction.timezone || 'N/A (UTC by default)'}` + Constants.CSV_SEPARATOR;
+ csv += `${(transaction.timezone ? moment(transaction.timestamp).tz(transaction.timezone) : moment.utc(transaction.timestamp)).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
+ csv += `${(transaction.timezone ? moment(transaction.timestamp).tz(transaction.timezone) : moment.utc(transaction.timestamp)).format('HH:mm:ss')}` + Constants.CSV_SEPARATOR;
+ csv += `${transaction.stop ? `${(transaction.timezone ? moment(transaction.stop.timestamp).tz(transaction.timezone) : moment.utc(transaction.stop.timestamp)).format('YYYY-MM-DD')}` : ''}` + Constants.CSV_SEPARATOR;
+ csv += `${transaction.stop ? `${(transaction.timezone ? moment(transaction.stop.timestamp).tz(transaction.timezone) : moment.utc(transaction.stop.timestamp)).format('HH:mm:ss')}` : ''}` + Constants.CSV_SEPARATOR;
csv += `${transaction.stop ? Math.round(transaction.stop.totalConsumptionWh ? transaction.stop.totalConsumptionWh / 1000 : 0) : ''}` + Constants.CSV_SEPARATOR;
csv += `${transaction.stop ? Math.round(transaction.stop.totalDurationSecs ? transaction.stop.totalDurationSecs / 60 : 0) : ''}` + Constants.CSV_SEPARATOR;
csv += `${transaction.stop ? Math.round(transaction.stop.totalInactivitySecs ? transaction.stop.totalInactivitySecs / 60 : 0) : ''}` + Constants.CSV_SEPARATOR;

Handle not available timezone in the exported csv