For an oData Rest service, I use Moment.js to create a date from a Unix timestamp and I'd like to ignore the timezone. My date is "2013-12-24", which is 1387839600 in Unix seconds.
Using
moment("2013-12-24", "YYYY-MM-DD").toISOString()
results in "2013-12-23T23:00:00.000Z", since I live in GMT+1. By the use of
moment.utc("2013-12-24", "YYYY-MM-DD").toISOString()
I get "2013-12-24T00:00:00.000Z" which is exactly what I want. I can simply remove Zulu time's "Z" at the end.
But my date's real representation is a Unix timestamp. So if I do
moment.utc(1387839600, "X").toISOString()
I always get "2013-12-23T23:00:00.000Z", but I want it to return "2013-12-24T00:00:00.000Z".
Where's my fault? Thanks for your help!