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.

Datepicker return invalid date if I enter the date by keyboard - firefox 39 #4040

Closed
@rrawrriw

Description

@rrawrriw

Hello,

first, thanks for your effort to build this lovely helper library.

I attempt to build a search form where you can search documents by date. So I used the datepicker directive. You can choose the date with the popup or enter it with the keyboard in a input field. When I use the popup it works fine. However if I enter the date with the keyboard it dosen't work. I made a small Plunker example http://plnkr.co/Nc58sJjWE9cmItRmkSwg. What I sad is just right for the firefox 39 when I use chrome 43 it works fine.

When you open the plunker example and put in a date in format dd.MM.yyyy an hit the GO! button you shouldn't get a valid date printed out in the debug-console.

I checked out the code and find out that following event listener dosen't work always in firefox 39. Also the Date function in firefox can not handle a string in the given format. So we don't have a right baseDate in the parser function.

      ngModel.$viewChangeListeners.push(function () {
        if (dateParser.parse(ngModel.$viewValue, dateFormat, scope.date)) {
          scope.date = dateParser.parse(ngModel.$viewValue, dateFormat, scope.date);
        } else {
          scope.date = new Date(ngModel.$viewValue);
        }
      });

If I make a simple example without ui-bootstrap. Just a handmade directive where I registred a function at the change listener it works fine in firefox an chrome.

Hopefully you can understand my english. And hopefully I didn't missed something elementary and have been wasting your time?

Best regards, Tim.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions