I am getting Nan error when I am using parseInt with date strings. I am getting finalRelease and Original Release value in form of string. I am splitting the value and try to access using index. I am getting correct month in case of finalMonth but it is showing Nan in case of originalMonth.
finalRelease = "2017-07-20"
originalRelease = "2017-08-09"
if(finalRelease!=null && originalRelease!=null) {
var finalDate = finalRelease.split('-');
var originalDate = originalRelease.split('-');
var finalMonth = parseInt(finalDate[1])-1;
var originalMonth = parseInt(originalDate[1])-1;