I have an API call that receives a date string like 2016-2-12 //('YYY-MM-DD').
I am using moment-timezone, but not having any luck.
The end goal is to get the unix timestamp for midnight 2016-2-12 of the timezone of the applicable site (not the server)
I have tried a lot of combinations of something like:
moment.tz('2016-2-12', 'America/New York').utc();
But it seems to receive the input date as UTC (my server is set to UTC) then do the timezone conversion AFTER, giving me a date for the day before.
For reference I am generating a report for a date range. So if the input is:
&start=2016-4-12&stop=2016-4-15 //and the timezone is America/New York
I expect a start time of 2016-4-12T00:00:00 -04:00
but i keep ending up with dates from the day before.
I expect the function to be something like:
moment.tz('2016-2-12', 'YYYY-MM-DD', 'America/New York').startOf('day').utc();