These are chat archives for Automattic/mongoose

14th
Feb 2016
Cade Ward
@cadebward
Feb 14 2016 00:31
This message was deleted
Saurabh Vyas
@saurabhvyas
Feb 14 2016 14:57
my task schema looks like this : var taskSchema = mongoose.Schema({
task: String,
time:Date,
done:{
type:Boolean,
default: false
},
id:Number,
}); on GET request to "/" I am rendering my express app and sending tasks , but on the frontend I see not so pretty standard date object can I get/store date in a more pretty human readable format?
Dipankar Arhat
@dbelieves
Feb 14 2016 14:57
@saurabhvyas , use date() function
or angularjs date filter
Saurabh Vyas
@saurabhvyas
Feb 14 2016 14:59
If I am not using angularjs and want to use Date.now()? how will it work , will I need to change mongoose schema or changes willbe made only on the frontend?
Dipankar Arhat
@dbelieves
Feb 14 2016 15:00
you can do it on both ends.
but i prefer not touching the mongoose one
Saurabh Vyas
@saurabhvyas
Feb 14 2016 15:02

<% for(var i=0; i<undonetasks.length; i++) {%> <li class="taskli"><%=undonetasks[i].task%></li>

<span id="time"><%=undonetasks[i].time%></span>

<% } %>

can you suggest changes on this part of code?
Dipankar Arhat
@dbelieves
Feb 14 2016 15:05
when you fetch data for undonetasks obj/ array.
iterate over it and using date() function change to readable format
Saurabh Vyas
@saurabhvyas
Feb 14 2016 15:08
@dbelieves okay thanks