@@ -320,7 +320,7 @@ describe('Class: PowertoolsLogFormatter', () => {
320320 test ( 'it formats the timestamp to ISO 8601, accounting for the `America/New_York` timezone offset' , ( ) => {
321321 // Prepare
322322 process . env . TZ = 'America/New_York' ;
323- /*
323+ /*
324324 Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
325325 The positive value indicates that `America/New_York` is behind UTC.
326326 */
@@ -341,7 +341,7 @@ describe('Class: PowertoolsLogFormatter', () => {
341341 process . env . TZ = 'America/New_York' ;
342342 const mockDate = new Date ( '2016-06-20T12:08:10.910Z' ) ;
343343 jest . useFakeTimers ( ) . setSystemTime ( mockDate ) ;
344- /*
344+ /*
345345 Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
346346 The positive value indicates that `America/New_York` is behind UTC.
347347 */
@@ -362,7 +362,7 @@ describe('Class: PowertoolsLogFormatter', () => {
362362 process . env . TZ = 'America/New_York' ;
363363 const mockDate = new Date ( '2016-06-20T00:08:10.910Z' ) ;
364364 jest . useFakeTimers ( ) . setSystemTime ( mockDate ) ;
365- /*
365+ /*
366366 Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
367367 The positive value indicates that `America/New_York` is behind UTC.
368368 */
@@ -381,7 +381,7 @@ describe('Class: PowertoolsLogFormatter', () => {
381381 test ( 'if `envVarsService` is not set, ensures timestamp is formatted to `UTC` even with `America/New_York` timezone' , ( ) => {
382382 // Prepare
383383 process . env . TZ = 'America/New_York' ;
384- /*
384+ /*
385385 Difference between UTC and `America/New_York`(GMT -04.00) is 240 minutes.
386386 The positive value indicates that `America/New_York` is behind UTC.
387387 */
@@ -471,6 +471,22 @@ describe('Class: PowertoolsLogFormatter', () => {
471471 // Assess
472472 expect ( timestamp ) . toEqual ( '2016-06-20T12:08:10.000Z' ) ;
473473 } ) ;
474+
475+ test ( 'it is using UTC timezone when env var is set to :/etc/localtime' , ( ) => {
476+ // Prepare
477+ process . env . TZ = ':/etc/localtime' ;
478+
479+ jest . spyOn ( Date . prototype , 'getTimezoneOffset' ) . mockReturnValue ( 0 ) ;
480+ const formatter = new PowertoolsLogFormatter ( {
481+ envVarsService : new EnvironmentVariablesService ( ) ,
482+ } ) ;
483+
484+ // Act
485+ const timestamp = formatter . formatTimestamp ( new Date ( ) ) ;
486+
487+ // Assess
488+ expect ( timestamp ) . toEqual ( '2016-06-20T12:08:10.000+00:00' ) ;
489+ } ) ;
474490 } ) ;
475491
476492 describe ( 'Method: getCodeLocation' , ( ) => {
0 commit comments