Today's date -30 days in JavaScript
<p>I need to get today's date -30 days but in the format of: "2016-06-08"</p>

<p>I have tried <code>setDate(date.getDate() - 30);</code> for -30 days.</p>

<p>I have tried <code>date.toISOString().split('T')[0]</code> for the format.</p>

<p>Both work, but somehow cannot be used together.</p>