문제

I'm trying to loop through an array and work out which items are dates. To do this I am running the values through Date.parse(value), which is supposed to only parse valid dates.

The problem is that this string is parsed as a date

"Test Title 1"

Example: http://jsfiddle.net/jonhobbs/LHeQ8/

This tells me that you can't trust Date.parse at all but I don't know of an alternatve. I've tried the moment.js library and that gives me the same thing as it uses Date.parse() internally.

도움이 되었습니까?

해결책

Answer was to use a regex instead.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top