angularjs - 更新调用丢失配置变量中的日期值
问题描述
您好,我有一个应用程序创建了一个包含 Date 变量的对象。然后将该对象传递给 http 更新函数。不幸的是,除了日期重置为 2018-06-06T04:00:00 而不是添加的实际时间之外,所有内容的更新看起来都很棒。出于测试目的,我使用相同的对象有效负载分别运行更新查询,并且它运行良好,所以我知道不是 api。有什么想法我可能做错了吗?
用于有效负载的 JSON 中的项目:
{"id":10, "name":"test", "description":"测试描述", "startDate":"2018-06-06T23:30:00.000Z", "endDate":"2018-06- 07T02:30:00.000Z"}
代码:
app.config(function($routeProvider, $resourceProvider, $httpProvider) {
$httpProvider.defaults.headers.common = {Accept: "application/json, text/plain, */*"};
//other code to set up routes, also added an interceptor to verify the data been sent, this is where I was able to see the data's Date time is reset.
});
//function to update
function updateObj(item){
$http.put(urlToApi, item, {headers:{'Content-Type': 'application/json', 'Accept': 'application/json'}})
.then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log("ERROR: " + response);
});
}
解决方案
推荐阅读
- sequelize.js - 如何在 Sequelize ORM 中获得 Y 最多的前 X 个用户?
- node.js - Express-subdomain 没有看到路由
- sql-server - T-SQL:用于计算第 N 个百分位数的聚合函数
- c# - 如果项目存在,如何查询 Cosmos DB 并获取布尔值
- mysql - 如何将数据库从我的笔记本电脑复制到 AWS
- java - 当我在 step def 方法中使用 Cucumber(场景场景)参数时,使用 1 个参数声明的错误显示。小黄瓜步骤有 0 个参数
- java - 将 BufferedImage 转换为字节数组并添加 alpha 的快速方法
- google-cloud-platform - Google Cloud 取消替换组中的实例
- java - 关闭时的JFrame Exit不会出现在java中
- c++ - C++ Boost - 使用压缩稀疏行图的广度优先搜索