node.js - Mongoose date format -
currently having issue retrieving dates mongoose. schema:
var activityschema = new schema({ activityname : string , acitivtyparticipant : string , activitytype : string , activitydate : { type: date, default: date.now } , activitypoint : number });
this defaults use "mm.dd.yyyy", data have in format "dd.mm.yyyy" defaults date.now.
does know if there "format: "dd.mm.yyyy" function can put directly in schema? other ideas? (would not update data)
thank replies
as far know, mongoose doesn't have 'default format'. instead, saves date
instances (i think) rfc 822 timestamps (mon jan 02 2012 00:00:00 gmt+0100 (cet)
), , parses them database running new date(input)
.
that last action problem:
> new date('01.02.2012') mon jan 02 2012 00:00:00 gmt+0100 (cet)
as can see, javascript parses mm.dd.yyyy
. don't know if that's solvable without having update database.
Comments
Post a Comment