Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Possible bug with the Clear button in the datepicker popup #5906

@rcholic

Description

@rcholic

Angular Version: 1.4.9
Bootstrap Version: 3.3.4
Angular UI Bootstrap: 1.3.2
Browser tested: Firefox and Chrome (latest)

We run into issues with the Clear button in the date picker popup, which cannot clear the date. So I did some digging in the datepicker popup.js code, and found a bug in the following code, where the null or undefined value (for dt) is not taken care of, causing the $scope.date variable to remain (therefore Clear button does not work for me):

// Inner change
  $scope.dateSelection = function(dt) {
    if (angular.isDefined(dt)) {
      $scope.date = dt;  // what if dt is null or undefined here? $scope.date is not reset then!
    } 
    var date = $scope.date ? dateParser.filter($scope.date, dateFormat) : null; // Setting to NULL is necessary for form validators to function
    $element.val(date);
    ngModel.$setViewValue(date);

    if (closeOnDateSelection) {
      $scope.isOpen = false;
      $element[0].focus();
    }
  };

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions