title: Django date to javascript at the template
body: <p>What would be the easy way of achieving such below? selected_date comes from django context as a python date :</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var selected_year = {{ selected_date|date:"Y" }}
      var selected_month = {{ selected_date|date:"m" }} - 1;
      var selected_day = {{ selected_date|date:"d"}}
      var selected_date = new Date(selected_year, selected_month, selected_day);
      alert(selected_date);
  &lt;/script&gt;
  </code></pre>