title: How to set a variable as Date type in ejs?
body: <p>I'm using express.js, mongoose and ejs, I have a Model like</p>
  
  <pre><code>var t_schema = new mongoose.Schema({
    name: String,
    startFrom: Date,
    ...
  })
  
  router.get('/', function(req,res) {
   t_model.findOne({name: req.body.name}, function(result) {res.render('t', result)})
  })
  </code></pre>
  
  <p>So result contains a Date type startFrom</p>
  
  <p>And in my ejs :</p>
  
  <pre><code>$('#startDate').datepicker.set(&lt;%= result.startDate %&gt;)
  </code></pre>
  
  <p>which is a String instead of Date, while datepicker.set needs Date.</p>
  
  <p>How can I make result.startDate as a Date?</p>
  
  <p><code>$('#startDate').datepicker.set(new Date('&lt;%= result.startDate %&gt;'))</code></p>
  
  <p>seems work, but the timezone is incorrect.</p>
  
  <p>And 2.)</p>
  
  <p>What is the best practice to manipulate Date in Nodejs/mongodb?
  My users will come from different timezone, so I would like to show datetime in their timezone in Browser, I think maybe its better to store date as UTC in Mongodb?</p>