Within a form, users are prompted to input a date which is then stored in a Mongo DB. Upon checking the console log, the date appears correct (in ISODate("2017-05-21T00:00:00Z")). However, when this date is passed as an argument in EJS, the displayed date differs.
Here is the data stored in mongoDB: "Begin" : ISODate("2017-05-21T00:00:00Z")
While this is the data shown within the EJS File: '2017-05-20'
To format the date, I utilized:
moment(data.Begin).format('YYYY-MM-DD')
If moment isn't used, the date displayed on EJS reads:
"Sat May 20 2017 19:00:00 GMT-0500 (Central Daylight Time (Mexico))"
This output is incorrect regardless.