[Solved] new Date(2015,2,30) and new Date(‘2015-2-30’)


The output will be

console.log(new Date(2015,2,30)); // here 2 represents the march, ,month starts from 0 where 0 represents first month
console.log(new Date('2015-3-30'));

Mon Mar 30 2015 00:00:00 GMT+0530 (India Standard Time)
Mon Mar 30 2015 00:00:00 GMT+0530 (India Standard Time)


new Date('2015-2-30') // it means 30th day in February; which will convert it to second march 

4

solved new Date(2015,2,30) and new Date(‘2015-2-30’)