Angularjs Angular JS引导ui日历问题

Angularjs Angular JS引导ui日历问题,angularjs,angular-ui-bootstrap,angularjs-ng-model,Angularjs,Angular Ui Bootstrap,Angularjs Ng Model,我面临着非常奇怪的问题与角度ui引导日历 这是我创建的示例 这种情况是,当页面着陆时,它在ng模型变量中显示正确的日期,而当我从日历中选择日期时,ng模型在UST中显示日期 e、 g.当我从日历中选择日期为2012年5月1日时,ng模型绑定属性显示为2012-01-04T18:30:00.000Z。我想要文本框中的内容,即2012年5月1日 如何克服这个问题 <!doctype html> <html ng-app="ui.bootstrap.demo"> <he

我面临着非常奇怪的问题与角度ui引导日历

这是我创建的示例

这种情况是,当页面着陆时,它在ng模型变量中显示正确的日期,而当我从日历中选择日期时,ng模型在UST中显示日期

e、 g.当我从日历中选择日期为2012年5月1日时,ng模型绑定属性显示为2012-01-04T18:30:00.000Z。我想要文本框中的内容,即2012年5月1日

如何克服这个问题

<!doctype html>
<html ng-app="ui.bootstrap.demo">
 <head>
 <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.12.1.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
</head>
<script>
    angular.module('ui.bootstrap.demo', ['ui.bootstrap']);
    angular.module('ui.bootstrap.demo').controller('DatepickerDemoCtrl', function ($scope) {
      $scope.today = function() {
        $scope.dt = new Date();
      };

      $scope.dates = [{ date:'01/01/2012',isOpen:false, isDisabled:false}, {date:'05/05/2000',isOpen:false, isDisabled:false}, {date:'',isOpen:false, isDisabled:true}];

      $scope.today();

      $scope.clear = function () {
        $scope.dt = null;
      };

      // Disable weekend selection
      $scope.disabled = function(date, mode) {
        return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
      };

      $scope.toggleMin = function() {
        $scope.minDate = $scope.minDate ? null : new Date();
      };
      $scope.toggleMin();

      $scope.open = function($event, date) {
        $event.preventDefault();
        $event.stopPropagation();
        date.isOpen=true;
        $scope.opened = true;
      };

      $scope.dateOptions = {
        formatYear: 'MM/dd/yyyy',
        startingDay: 1
      };

      $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
      $scope.format = 'MM/dd/yyyy';
    });
</script>
 </head>
 <body>

<div ng-controller="DatepickerDemoCtrl">
    <h4>Popup</h4>
    <br/>
<br/>
My Dates object {{dates}}
<br/>
<br/>
<div class="row" ng-repeat='x in dates'>
<span style="margin-left:20px">{{x.date}}</span>
    <div class="col-md-6">
        <p class="input-group">
          <input type="text" class="form-control" datepicker-popup="{{format}}" ng-model="x.date" is-open="x.isOpen" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" ng-required="true" close-text="Close" />
          <span class="input-group-btn">
            <button type="button" ng-disabled="x.isDisabled" class="btn btn-default" ng-click="open($event,x)"><i class="glyphicon glyphicon-calendar"></i></button>
          </span>
        </p>
    </div>
    <br/>
<br/>
</div>
<hr />
</div>
  </body>
</html>

实际上,您的模型具有正确的值。.000Z是秒的分数,Z表示UTC时区


这里也有同样的问题:

有些人回答了这个问题。你可以参考上面的链接

这对我有用