【发布时间】:2019-06-16 18:37:45
【问题描述】:
我在firefox浏览器中调试.js文件,
我的代码是这样的,
function getReport(searchCriteria, page, pageSize, sortBy, sortingDirection) {
return $http.post(fullPath + '/Evaluations/GetPerformanceReport', searchCriteria, { params: { page: page, pageSize: pageSize, sortBy: sortBy, sortingDirection: sortingDirection } }
);
}
在上述方法中,我的 searchCriteria 有一个参数从日期“2018-10-10”到日期是“2019-01-01”在 Controler 中我得到这个值“{0001-01-01T00:00:00 }" 两个日期。
Controller 从脚本中获取数据的方法是这样的,
public JsonResult GetReport(ReportSearch searchCriteria, int page, int pageSize,
string sortBy, string sortingDirection)
{}
这里的 ReportSearch 是具有属性的类,
Public class ReportSearch
{
public DateTime From { get; set; }
public DateTime To{ get; set; }
}
我不明白为什么将“2018-10-10”日期格式更改为“0001-01-01T00:00:00”?
已编辑:
在js函数中我其实有
function getReport($scope.searchCriteria, ($scope.page * $scope.pageSize), $scope.pageSize, $scope.sortBy, $scope.sortingDirection) {
return $http.post(fullPath + '/Evaluations/GetPerformanceReport', searchCriteria, { params: { page: page, pageSize: pageSize, sortBy: sortBy, sortingDirection: sortingDirection } }
);
}
在调试时获取的 $scope.searchCriteria 中,我的值类似于 From:"2018-10-10" To:"2019-01-01"。在控制器中,我得到了这个值和模型,我得到了上面提到的“ReportSearch”类。在控制器中,我得到这样的日期“0001-01-01T00:00:00”
【问题讨论】:
标签: javascript jquery json datetime http-post