Skip to content

Commit

Permalink
test(csv-parse): check cast_date with string ending with space and nu…
Browse files Browse the repository at this point in the history
…mber
  • Loading branch information
wdavidw committed Jun 8, 2022
1 parent 59cf7a4 commit 5660ca1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/csv-parse/test/option.cast_date.coffee
Expand Up @@ -24,3 +24,16 @@ describe 'Option `cast_date`', ->
[ new Date('2050-11-27T00:00:00.000Z'), 'date2' ]
]
next err

it 'issue #342, value end with space and number', (next) ->
# Current implementation rely on `isNaN(Date.parse(value))`
# While it return `NaN` in Firefox, Node.js return a timestamp for
# `node -e 'console.info(Date.parse("Test 1"))'`
parser = parse """
Test 1
""",
cast: true
cast_date: true
, (err, [[record]]) ->
record.toISOString().should.match /^\d{4}-\d{2}-\d{2}/
next err

0 comments on commit 5660ca1

Please sign in to comment.