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

Datepicker malfunctioning in Firefox: fails to update the model when manually updating the date #3159

Closed
lnaia opened this issue Jan 6, 2015 · 11 comments

Comments

@lnaia
Copy link

lnaia commented Jan 6, 2015

Manually changing the date value, after the it was inserted, fails to update the model on Firefox.
It seems to deletes the content (?).

Check the fiddle for a proper example, open it on chrome and firefox.
http://jsfiddle.net/HB7LU/9779/

@lnaia lnaia changed the title Datepicker malfunctioning in Firefox Datepicker malfunctioning in Firefox: fails to update the model when manually updating the date Jan 6, 2015
@lnaia
Copy link
Author

lnaia commented Jan 7, 2015

Anything I can do to help more?

@glorat
Copy link

glorat commented Jan 10, 2015

Changing to
$scope.format = 'yyyy-MM-dd';

fixes it. It seems that it is a date editor, not a datetime editor. One issue (related?) in doing this is you'll find dates are internally expressed as datetimes at midnight local timezone. Remote the format filter in your display to see how it looks

@karianna
Copy link
Contributor

@darkbls I assume this was with Angular 1.3?

@lnaia
Copy link
Author

lnaia commented Jan 12, 2015

@karianna yes it was
@glorat thank you, is there any suggestion that would allow one to keep using the hour and minute?

@wesleycho
Copy link
Contributor

Transferred to Plunker for working version.

I will investigate.

@wesleycho wesleycho added this to the 0.13.0 milestone Mar 17, 2015
@wesleycho wesleycho self-assigned this Mar 17, 2015
@wesleycho
Copy link
Contributor

Interestingly, this might have to do with how the browsers interpret dates. The object set in the view for both Chrome and Firefox is a date when the user clicks on the date.

When the user deletes a character, say from 2015-03-18 00:00:00 to give 2015-03-1 00:00:00, Chrome thinks that new Date('2015-03-1 00:00:00) is a valid date string, while Firefox disagrees.

This new Plunker illustrates this.

In this case, Firefox's behavior looks to be more strict than Chrome's. It turns out that Safari also agrees with Firefox here, and Chrome is the outlier. I will investigate how IE behaves, but I believe that Chrome's behavior is actually the strange one here. I am not sure we should support this behavior.

@newmanw
Copy link

newmanw commented Mar 18, 2015

Not sure if it helps but, this format works in FF. Not entirely sure why

    $scope.format = 'MM/dd/yyyy HH:mm:ss';

Also FWIW I think it should be fixed. Not sure what to do about new Date('2015-03-1 00:00:00), but seems like once you type in a valid date, ie add a 7 to the end new Date('2015-03-17 00:00:00) the input should re-validate to a correct date, but it doesn't.

I will look into it more to see what else I can find.

@wesleycho
Copy link
Contributor

Well, that sort of makes sense - the string in the input does not match the format expected otherwise.

Maybe changing the $formatter so that it displays the date in the expected format would fix this issue.

@wesleycho
Copy link
Contributor

I think I've identified the cause - the date parser cannot recognize the HH:mm:ss format - I will work on adding support for that and have that fixed within the next couple of days.

@Lux90
Copy link

Lux90 commented Jul 17, 2015

Single quotes at the end of a date format fix the date typing issue in Firefox.
In my case solution looks as follows: datepicker-popup="yyyy-MM-dd''"

@ratheeshkannan
Copy link

Thanks Lux90, we had a similar issue and through your solution it worked in Firefox as of now. But just curious to know what is the logic behind putting a string inside a string. Maybe date object manipulation in firefox and now it's validating string instead of date object?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants