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

Setting date modifies passed date object #531

Closed
aaani opened this issue Sep 30, 2014 · 2 comments
Closed

Setting date modifies passed date object #531

aaani opened this issue Sep 30, 2014 · 2 comments
Milestone

Comments

@aaani
Copy link

aaani commented Sep 30, 2014

When I select a date using
datepicker.set('select', dateObj);
the passed dateObj is modified. This behavior isn't documented and may lead to potential issues in the application code.

Link to the code sample demonstrating the bug:
http://jsbin.com/regot/4/edit

@aaani
Copy link
Author

aaani commented Oct 4, 2014

Digging a little deeper. I found this line of code is the culprit:
https://github.com/amsul/pickadate.js/blob/3.5.4/lib/picker.date.js#L391

Instead of directly setting hours on the passed date object, we should create a deep copy of date object and work with it.

@amsul amsul closed this as completed in 0285986 Oct 6, 2014
@amsul amsul added this to the 3.5.5 milestone Oct 6, 2014
@Anand190790
Copy link

@amsul
I want event object for the selected date.
Currently my code is
$('#inputDate')
.attr('data-value', "2014-5-14");
DatepickerObject = $('#inputDate').pickadate({
'today' : '',
'close' : '',
'clear' : '',
onOpen : function() {
},
onSet : function() {
},
});

I want to get selected object touch positions.For example if I select any date, I want the co-ordinates of the selected date. i.e. x & y. Please help me here.

amsul added a commit that referenced this issue Dec 6, 2014
amsul added a commit that referenced this issue Dec 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants