This is the correct date for your version of Angular, however the date is formatted in UTC, which may seem incorrect if you are not fully aware of this.
The time zone is always zero UTC offset, as indicated by the suffix "Z".
UTC source
Take a look at Angular date filters . There are many options out of the box, and almost any desired format can be obtained - but most importantly, it is allowed for your time zone. For example...
{{dateModel | date:'shortDate'}} // -- prints 5/14/15 {{dateModel | date:'yyyy-MM-dd'}} // -- prints 2015-05-14
Plunker link
Learn more about explicitly providing the timezone parameter and trust the browser to resolve our time (Angular docs)
{{ date_expression | date : format : timezone }} // -- template binding $filter('date')(date, format, timezone) // -- javascript
The time zone to be used for formatting. He understands UTC / GMT and the continental abbreviations of the US time zones, but for general use, use the time zone offset, for example, β+0430β (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the browser time zone will be used.
If you prefer to explicitly define the time zone with ngModelOptions rather than using filters, you can do this with the following
<input type="date" ng-model="dateModel" ng-model-options="{timezone: timezone}" />
var date = new Date() $scope.timezone = ((date.getTimezoneOffset() / 60) * -100)
See this answer for an explanation of manual calculation logic.
Plunker Link - with ng-model-options
scniro
source share