Angular UI Bootstrap Timepicker - 24 小时制的值分配问题
Angular UI Bootstrap Timepicker - value assignment issue with 24hr times
时间选择器未正确处理 24 小时制时间分配。例如
<timepicker ng-model="$time" hour-step="1" minute-step="1" show-meridian="true"></timepicker>
当我这样做时:$scope.$time = "2012-04-23T18:25:43Z"
,时间选择器更新为 06:25 AM
。应该是 06:25 PM
.
即使我设置了show-meridian="false"
,它仍然显示06:25
。
ISO 8601 日期格式中的 "Z" 代表 UTC。因此,根据当前的本地时区偏移量,您的结果可能会有所不同。
For example, I am located on the east coast in the US. When daylight
savings is being observed here, my timezone offset is UTC−04:00,
otherwise it is UTC-05:00. For me, the result of the time portion of
2012-04-23T18:25:43Z in meridian is either: 2:25 PM or 1:25 PM
depending on the time of year.
检查下面的代码片段以查看 UTC 值与考虑您的时区偏移的区域设置特定时间选择器值的表示:
var app = angular.module('demo', ['ui.bootstrap']);
app.controller('MainCtrl', ['$scope', function ($scope) {
$scope.time = '2012-04-23T18:25:43Z';
}]);
@import url('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css')
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.13.0.js"></script>
<div ng-app="demo">
<div class="container" ng-controller="MainCtrl">
<h3>{{time}}</h3>
<timepicker ng-model="time" show-meridian="true"></timepicker>
<p>Your local timezone offset is: <strong> UTC {{time | date:'Z'}}</strong></p>
</div>
</div>
时间选择器未正确处理 24 小时制时间分配。例如
<timepicker ng-model="$time" hour-step="1" minute-step="1" show-meridian="true"></timepicker>
当我这样做时:$scope.$time = "2012-04-23T18:25:43Z"
,时间选择器更新为 06:25 AM
。应该是 06:25 PM
.
即使我设置了show-meridian="false"
,它仍然显示06:25
。
ISO 8601 日期格式中的 "Z" 代表 UTC。因此,根据当前的本地时区偏移量,您的结果可能会有所不同。
For example, I am located on the east coast in the US. When daylight savings is being observed here, my timezone offset is UTC−04:00, otherwise it is UTC-05:00. For me, the result of the time portion of 2012-04-23T18:25:43Z in meridian is either: 2:25 PM or 1:25 PM depending on the time of year.
检查下面的代码片段以查看 UTC 值与考虑您的时区偏移的区域设置特定时间选择器值的表示:
var app = angular.module('demo', ['ui.bootstrap']);
app.controller('MainCtrl', ['$scope', function ($scope) {
$scope.time = '2012-04-23T18:25:43Z';
}]);
@import url('//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css')
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.13/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.13.0.js"></script>
<div ng-app="demo">
<div class="container" ng-controller="MainCtrl">
<h3>{{time}}</h3>
<timepicker ng-model="time" show-meridian="true"></timepicker>
<p>Your local timezone offset is: <strong> UTC {{time | date:'Z'}}</strong></p>
</div>
</div>