I have encountered an issue with the datepicker I am using (specifically AngularStrap's datepicker) where it seems to be consistently displaying a date that is one day behind due to how dates are calculated in javascript. My main concern is figuring out how to prevent the timezone from being taken into account and simply sticking with the date entered without any adjustments.
For example, when I select February 1, 2014 in the datepicker interface, the displayed value shows as 2/1/2014 but ends up being saved as
Fri Jan 31 2014 19:00:00 GMT-0500 (EST)
, as it subtracts the 5 hours for my timezone from the input date. This behavior is not what I want. I expect the selected date to be preserved as entered, regardless of timezones.
My question is, what would be the most effective approach to alter or manipulate this value so that entering 2/1/2014 results in exactly that date, without any timezone conversion? Should I consider modifying the code within the datepicker itself (though I feel this might not be ideal)? Or could the solution involve adjusting the value before sending it to the backend by incorporating some kind of offset? If so, how can I add time to a value that appears in the console as
Fri Jan 31 2014 19:00:00 GMT-0500 (EST)
?