I have a date that I am converting to LocaleDateString and then splitting it into an array inside an angulrajs controller. When I try to convert to int the elements in the array I get NaN. The characters in the array are numbers but the parse is not working.
How can I parse that data properly?
Code:
var dateLocal = $scope.startDate.toLocaleDateString(); //Has this 6/5/2015
var dateSplitted = dateLocal.split("/"); //Has [6,5,2015]
var month = parseInt(dateSplitted[0]); //HERE If I use parseIntI get NaN originally it has 6
var day = dateSplitted[1];//Has 5
var year = dateSplitted[2]; Has 2015
I want to be aple to convert to string month day and year.