I have a form where the user inputs the date in the following format: YYYY-MM-DD

I store the date in Mongo DB. By default, Mongo DB stores it as a UTC Date.

Example:
User inputs 2018-02-06
Mongo stores: "Tue Feb 06 2018 00:00:00 GMT+0000 (UTC)"

Lets say I want to display this date back to the user.

The following code gives me the wrong date:

```
var eventDateString = $('#hiddenDate').val() // Just gets the date as stored in mongo
var dateObj = new Date(eventDateString)
var dateMom = moment(dateObj).format('dddd, MMMM DD YYYY');
console.log(dateMom)

```

What gets printed is:
"Monday, February 05 2018" 
This is incorrect, the date should be Feb 6.

Why is this happening?

I tried to solve the issue by doing this:

```
var eventDateString = $('#hiddenDate').val();
$('#show-eventDate').text(moment.utc(eventDateString).format('dddd, MMMM DD YYYY'));

```

I get the correct Result: "Tuesday, February 06 2018"

However, I get the following warning:

[![enter image description here](https://i.stack.imgur.com/gq9f1.png)](https://i.stack.imgur.com/gq9f1.png)

*(Deprecation warning: value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to <http://momentjs.com/guides/#/warnings/js-date/> for more info....)*

How do I get around this issue?