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 fb1b21c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/csv-parse/test/option.cast_date.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ describe 'Option `cast_date`', ->
[ new Date('2050-11-27T00:00:00.000Z'), 'date2' ]
]
next err

it 'value end with space and number (issue #342)', (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 fb1b21c

Please sign in to comment.