While converting date string into Date object getting NaN-NaN-NaN in Jquery? <p>Jquery + rails 4 + Mac + Safari</p> <pre><code>&lt;script&gt; function get_next_week_schedule(pre_date_index){ var date = $('#next_week_'+ pre_date_index).attr('value'); alert(date); //2014-06-02 var myDate = new Date(date); alert(myDate); // NaN-NaN-NaN } &lt;/script&gt; </code></pre> <p>This script is running on Mozilla and crome but while using Mac OS and Safari Browser its showing NaN-NaN-NaN while conversion of date string to Date Object. </p>