Skip to content

Commit

Permalink
Merge pull request #178 from Brad-Turner/fix/date-fns
Browse files Browse the repository at this point in the history
fix(date-fns): fix invalid time error
  • Loading branch information
marcolink authored Jun 7, 2022
2 parents 6dc5c37 + ea6f0d1 commit 691948c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import EventEmitter from 'events'
import bfj from 'bfj'
import figures from 'figures'
import format from 'date-fns/format'
import parseISO from 'date-fns/parseISO'

import getEntityName from './get-entity-name'

Expand Down Expand Up @@ -98,7 +99,7 @@ export function displayErrorLog (errorLog) {
console.log(`\n\nThe following ${errorsCount} errors and ${warningsCount} warnings occurred:\n`)

errorLog
.map((logMessage) => `${format(logMessage.ts, 'HH:mm:ss')} - ${formatLogMessageOneLine(logMessage)}`)
.map((logMessage) => `${format(parseISO(logMessage.ts), 'HH:mm:ss')} - ${formatLogMessageOneLine(logMessage)}`)
.map((logMessage) => console.log(logMessage))

return
Expand Down
4 changes: 2 additions & 2 deletions test/logging.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const logEmitterEmitSpy = jest.spyOn(logEmitter, 'emit')

const exampleErrorLog = [
{
ts: new Date('2018-01-01T01:01:43+01:00'),
ts: new Date('2018-01-01T01:01:43+01:00').toJSON(),
level: 'warning',
warning: 'warning text'
},
{
ts: new Date('2018-02-02T02:02:22+01:00'),
ts: new Date('2018-02-02T02:02:22+01:00').toJSON(),
level: 'error',
error: new Error('error message')
}
Expand Down

0 comments on commit 691948c

Please sign in to comment.