Currently, I am developing an application using Angular and incorporating Angular UI. One of the features I have implemented is a datepicker that is coded like this:
<input type="text"
ng-required="true"
name="targetDate"
uib-datepicker-popup="MMMM yyyy"
min-mode="'month'"
datepicker-mode="'month'"
is-open="opened"
ng-click="openCalendar()"
close-on-date-selection="true"
show-button-bar="false"
min-date="today"
ng-model="targetDate" />
The issue arises when I choose a month like July 2016, where the value stored in my targetDate model is "2016-06-30T21:00:00.000Z", which is essentially 3 hours behind July 2016. I suspect that this discrepancy may be due to the relationship between local time and Coordinated Universal Time (UTC) since I reside in a locale with a +2 hour offset from UTC. Despite this theory, I am uncertain as to why this anomaly occurs and how it can be rectified. Any thoughts or suggestions on this matter would be greatly appreciated.