1
私はui.bootstrap.timepickerを使用してアプリケーションに時間間隔を追加しています。 これは私が時刻を選択するところであり、ボタンのINSERT & SAVEはapiにデータを送信します。 ui.bootstrap.timepickerは2時間未満で返します
問題は、ここで選択した時間が表示されますが、APIに送信すると時間は2時間少なくなります。 これは要求ペイロード
{from_time: "2017-03-29T11:37:05.541Z", to_time: "2017-03-29T12:42:05.549Z"}
from_time:"2017-03-29T11:37:05.541Z"
to_time:"2017-03-29T12:42:05.549Z"
ですこれは私のhtml
<form class="form" role="form" ng-submit="addRow(fromUrbanTime, toUrbanTime)">
<div class="col-md-12">
<div class="col-md-6">
<div class="col-md-6">
<h5><b>{{'FROM'| translate}} (h)</b></h5>
<div uib-timepicker ng-model="fromUrbanTime" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></div>
<hr>
</div>
<div class="col-md-6">
<h5><b>{{'TO'| translate}} (h)</b></h5>
<div uib-timepicker ng-model="toUrbanTime" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></div>
<hr>
<button type="submit" class="btn btn-default">Insert & Save</button>
</div>
</div>
</div>
<pre class="alert alert-info">Time is: {{fromUrbanTime | date:'shortTime' }}</pre>
<pre class="alert alert-info">Time is: {{toUrbanTime | date:'shortTime' }}</pre>
</form>
であり、これは
//time picker
$scope.mytime = new Date();
$scope.hstep = 1;
$scope.mstep = 5;
$scope.ismeridian = false;
$scope.clear = function() {
$scope.mytime = null;
};
//adding new time intervals
$scope.addRow = function(fromUrban, toUrban){
var config = {
headers: {
"Content-Type": "application/json",
"X-HTTP-Method-Override": "POST"}
};
var data = {
"from_time": fromUrban,
"to_time": toUrban
};
$http.post(serviceBase + 'aaaaa/' + $scope.urbanConfig.id + '/screen-intervals', data, config)
.success(function (data, status, headers, config) {
Notification.success({message: $filter('translate')('URBAN_TIME_RANGE'), delay: 3000, positionY: 'bottom', positionX: 'right'});
//startTimer();
$scope.urbanTimeRange.push(data);
$scope.$watchCollection('urbanTimeRange', function (newValue, oldValue, scope) {
}, true);
})
ブラウザの開発ツールでリクエストされていますか?私はちょうどフロントエンドではないことを確かめたいですが、バックエンドで..私の投稿リクエストペイロードに – Dale
を選択したのと同じ値がブラウザから送信されているのを見てください。時間は2時間少なくなります.... – Arter