Angularstrap Datepicker在ngmodel

时间:2015-06-08 02:41:44

标签: javascript angularjs

我正在为datepicker使用角度带子库。当我从日历中选择任何日期时,先前的日期在ngmodel中设置。

enter image description here

如果将日期设置为输入的默认值,则日期设置正确。

enter image description here

$scope.pickerDateTime2 = new Date();
$scope.pickerChange = function () {
  var tz = jstz.determine(); // Determines the time zone of the browser client
  var name = tz.name();

  $scope.dateTimeUtc = ngmTimeCalc.convertFromPicker($scope.pickerDateTime2, name);
}

$scope.reloadPicker=function(){
  $scope.pickerChange();
  var tz = jstz.determine(); // Determines the time zone of the browser client
  var name = tz.name();

  $scope.pickerDateTime2 = ngmTimeCalc.convertToPicker($scope.dateTimeUtc, name);

}

Plnkr:http://plnkr.co/edit/KjEtU99clbxZGZwDvHAC?p=preview

如何在用户从日历中选择时设置正确的日期

0 个答案:

没有答案