angular.js - When angular uses $http post data, why is datetime automatically formatted into UTC? Can it not be formatted?
天蓬老师
天蓬老师 2017-05-15 17:10:05
0
1
612

Figure 1 shows the value of the variable printed before $http is sent;
Figure 2 shows the value captured when $http is sent.

Can I prevent it from automatically converting to UTC and keep 2016-12-15?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(1)
洪涛

Thanks for the invitation.

Your data itself is a time object, but if you want to post, its data format is forced to be converted to the related type of string.

It is recommended that you format the data into a corresponding string before posting.

You can use the date built-in filter in angular

app.controller('myCtrl', function($scope, $filter) {
    console.log($filter('date')(new Date(), 'yyyy-MM-dd'))
});
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template