Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<select> is broken when options values are bound to Dates #7928

Closed
shameleo opened this issue Mar 29, 2018 · 1 comment · Fixed by #7940
Closed

<select> is broken when options values are bound to Dates #7928

shameleo opened this issue Mar 29, 2018 · 1 comment · Fixed by #7940

Comments

@shameleo
Copy link

Version

2.5.16

Reproduction link

https://jsfiddle.net/azpxdt3a/1/

Steps to reproduce

Try select any item except first one.

What is expected?

Item selected.

What is actually happening?

always shows first item. Once any item except first is selected, it's no more possible to select first one (actually, it's possible, as shows correct selected item after the same item was selected twice in a row)


It seems the bug was introduced in ver 2.4.2. Does not reproduced with objects instead of dates: https://jsfiddle.net/pr847ek7/

@w3cj
Copy link

w3cj commented Mar 30, 2018

After looking into it, looseEqual does not handle dates correctly.

https://github.com/vuejs/vue/blob/dev/src/shared/util.js#L273

I added a check for dates in looseEqual, but not sure if this is the best way to go about it. Could use a second pair of eyes. 👀

posva added a commit to posva/vue that referenced this issue Mar 31, 2018
Fix vuejs#7928
thanks to @w3cj for the initial version. This one is using getTime instead of toUTCString because it
is much faster to compare
yyx990803 pushed a commit that referenced this issue Oct 24, 2018
Fix #7928
thanks to @w3cj for the initial version. This one is using getTime instead of toUTCString because it
is much faster to compare
f2009 pushed a commit to f2009/vue that referenced this issue Jan 25, 2019
Fix vuejs#7928
thanks to @w3cj for the initial version. This one is using getTime instead of toUTCString because it
is much faster to compare
aJean pushed a commit to aJean/vue that referenced this issue Aug 19, 2020
Fix vuejs#7928
thanks to @w3cj for the initial version. This one is using getTime instead of toUTCString because it
is much faster to compare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants