I'm trying to compare dates from database (firebase) with NOW. I'm using moment.js and it's not working. I think it has something to do with the time zone (or UTC+01:00)...
var date1 = moment("2016-11-20T14:00:00");
moment(date1).isSameOrAfter( moment() ) // returns true
Dates should always be saved in UTC. If you use string type the UTC date time value in ISO format.
So while saving convert from client time zone into UTC and while retrieving convert from UTC into client time zone.
Comparison should be done between two dates in the same time zone.
If the database value is in UTC and then you have to parse as .utc() while creating a moment object.
Change the NOW value to UTC before comparing.
Alternatively you can change the database value from UTC to local.
Keep the NOW value as is before comparing.