Twipped / Kalendae

A javascript date picker that just works.
MIT License
1.99k stars 285 forks source link

Removing the selected date #87

Closed valx76 closed 11 years ago

valx76 commented 11 years ago

If I'm deleting the content of the text input when a date is chosen, loose the focus of the input and give the focus again, a problem occurs.

First, it writes 'undefined' in the text field, and then, if we lose/get focus again, it will give a bugged date (0000-01-01).

My goal is to reset the field. I think, when we're deleting the input content, the field should be blank and not with "undefined" text inside..

EDIT: I'm using this code

<input class="auto-kal" data-kal="direction:'future',format:'YYYY-MM-DD'" type="text" />

Thanks

tagliala commented 11 years ago

@valx76 can you please give a try the build on the dev branch?

valx76 commented 11 years ago

Great it works now when removing the whole date string :)

Btw, I think the input field should be disabled by default, cauz' if we remove the last number of the result date (for example), it will change the date to a bugged one too..

In my case, I fixed the problem with a disabled input and it works well !

tagliala commented 11 years ago

oh right, got it

1/1/2013 -> backspace -> 1/1/0201

Very odd, but I think the input field is done this way to allow the user to input dates without having to use the calendar.

With the current implementation, however, this is impossible... I will take a look

valx76 commented 11 years ago

Yes, that's strange.. Hope this helps.

tagliala commented 11 years ago

I'm leaving this open. it will be automatically closed when the fix will be committed to master branch

valx76 commented 11 years ago

Oh right, I didn't know about that (not a really git user yet ^^) !

tagliala commented 11 years ago

no problem

Twipped commented 11 years ago

I suspect this was caused by Pull Request #75. I think I saw this coming but couldn't remember the exact reason. I'll try to take a look at it today if I get time.

Twipped commented 11 years ago

Fixed in commit a3c5377b4c

tagliala commented 11 years ago

ok I need to revert my fix because now it's useless

Twipped commented 11 years ago

Which, 7ee5fbbce530c? There's no need to revert that, it probably should be there anyway.

tagliala commented 11 years ago

yes. I tried without it and it's fine .ok I will not remove it