我有一个屏幕上带有一个日期字段(开始日期),用户可以输入任何日期。
<label class="item item-input">
<span class="input-label">Start Date</span>
<input type="date" ng-model="currentItem.OpenDate">
</label>
我在保存按钮的点击事件中添加了以下内容。
console.log("Normal date " + $scope.currentItem.OpenDate);
控制台显示以下日期。
Normal date Fri May 01 2015 00:00:00 GMT-0400 (Eastern Daylight Time)
这是推送事件。
$scope.data.accounts.push({ 'AccountName': $scope.currentItem.AccountName, 'StartBalance': $scope.currentItem.StartBalance, 'OpenDate': $scope.currentItem.OpenDate, 'AccountType': $scope.currentItem.AccountType });
然而,日期$scope.currentItem.OpenDate
没有被保存到Firebase中,其余的数据都保存正常。我漏掉了什么?
getTime()
更加通用,更易于在查询和排序中使用,并且总体上是一个更加实用的解决方案。 - Kato