Reputation: 75
Im importing an txt file into an array using jquery like so:
var testarray= new Array();
$.get('locationtosavedfile', function(data){
testarray= new Date(data.split('\n'));
console.log(testarray);
});
The contents of the file look like so:
"October 12, 2013 06:06:00"
"October 12, 2013 06:36:00"
"October 12, 2013 07:19:00"
"October 12, 2013 07:24:00"
"October 12, 2013 07:39:00"
"October 12, 2013 07:54:00"
"October 12, 2013 08:06:00"
"October 12, 2013 08:46:00"
"October 12, 2013 09:06:00"
The file is loaded into the array fine though its not making a date due to an formatting issue but im sure it should be okay? the text its importing is the same format as
new Date("October 12, 2013 10:12:00");
Which when added manually does work.
The error im getting is: Invalid Date. If I output the array the results are all there and separated by a comma.If there is something i'm missing let me know..
Upvotes: 0
Views: 1187