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
TypeError: Cannot read property ... of undefined #34
Comments
+1, using .clear() function or setting null value will trigger isSame() bug |
hello, VERSION : Tempus Dominus Bootstrap4 v5.0.0-alpha15 tempusdominus-bootstrap-4.min.js:7 Uncaught TypeError: Cannot read property 'isSame' of undefined tempusdominus-bootstrap-4.min.js:7 Uncaught TypeError: Cannot read property 'clone' of undefined |
+1 Same problem as explained by @tamarokun when useCurrent option is set to false. |
+1 Same problem. |
2 similar comments
+1 Same problem. |
+1 Same problem. |
yes same here. It's an initialization problem. tempusdominus seems to auto initialize when it finds css class 'datetimepicker-input' or a data-toggle attribute with value 'datetimepicker'. |
Same here with alpha18 |
hello, so after so mutch time without solution I craft my custom solution.
return this._dates[this._getLastPickedDateIndex()] || moment(null);
|
@seltix5 This solution triggers |
hello @ggjersund. |
Hello, (version 5.0.0-alpha18). Console prompts error of "Cannot read property 'isSame' of undefined" at step2 if without @seltix5 's solution, Is there other ways? |
Hello,
|
Try this workaround if you don't want to alter the library: Run the following just after running
The docs say the |
+1 Same problem. |
Same problem. When will this be fixed? I dont want to alter the lib. |
The problem still happening with the option {useCurrent: false}. I have done a jsfiddle with the example. The solution seems to be alter the lib as says @denisdiniz001 |
The problem happening also if you clear the input field and try to select a date again. |
Same issue. Any idea how to fix |
Please notify us when it'll get solved. It's annoying to find out that there is no way to tackle this issue without having to alter the library |
i received a similar issue |
Any update? I can't set a simple example with an empty date without crashing in _getLastPickedDate. @denisdiniz001 workaround works just right as a temporary solution |
Having the same issue, mine surfaces as "Cannot read property '_options' of undefined"... There have been two stable releases since this issue and a solution was proposed. @Eonasdan I am not a JavaScript specialist, some feedback from you on if this is a bug that will be addressed (and a ballpark idea of timeline) or caused by incorrect implementation would be very helpful. Thanks |
submitted a PR. Couldn't find the code in src, only in build |
A better way to fix this issue is to look at the root cause. When the _setValue is called with a NULL is does not restore the dates[], causing subsequent tests on it to fail. The clue is that when the control is initialised with a null value the originator has ensure the dates[] has a value at position 0. I simply modified the _setValue to handle the null and restore the _dates[] to ensure there was always a value at position 0 by adding the code below to line 407 in the _setValue method. Hope this save some time for all. |
when will the fix? |
@fielde Your fix worked for me, thank you so much! |
for me too, how is this still not fixed? :D |
@fielde fix worked! for those who prefer copy and pasting the code
|
When will the PR get accepted or when will a permanent fix be published? |
Hey! Thanks for the great plugin, you did awesome job! While looking for a workaround of this issue, i founded that @fielde solution is working, but working with default locale. When you reseting datepicker with this code
you getting your current locale from the moment.js, not the one that was changed in the options. Playing a little with code, i founded that just adding
Hope this would help someone and issue will we solved soon, because we are unable to use you lib from NPM unfortunately due to the source changes :( Thanks! |
References #143 Using a self-patched version of tempusdominus/bootstrap-4 for now, see berrnd/tempusdominus-bootstrap-4@2cf725f and tempusdominus/bootstrap-4#34
why hasn't this been solved for a long time?! i need clear function, but it doesn't work correctly |
Hi, Just try this out: Hope it'd save some time of yours. |
Hi, |
Resolved removing the class "input-group" in the HTML. |
Previously I was using a modified version that applied the fix from @mrlss but I wanted to see if it was possible to use the original build and simply override the functions. Below is my code, and it seems to work:
This should allow those that install the library using a cdn or NPM to apply the fix without having to modify the source. |
Thanks, what I did is that I removed id's with datetimepicker"NN", and removed datetimepicker-input classes from elements, now it works like charm. |
Same here, I've removed data-toggle attribute and datetimepicker-input class from the html. I then initialize it and add data-toggle just right after. |
2017.. by the way this error is more terrible than I thought hehehe.. I started using the package today and came across it.. Any news on adjusting this or the package is abandoned? |
Hi, what I did is that I removed id's with datetimepicker"NN", and removed datetimepicker-input classes from elements, now it works like charm. |
Right, I went back to version 4 which seems to be working better. Some errors that I found in this version do not happen in the previous one, I ended up wasting some time trying to adjust this, it seems that this package stopped at "time" =/ |
Hi @fielde you had modified bootstrap js right? |
Thanks @JasminSAB, your solution did the trick for me. |
Hi, is this issue expected to be resolved soon ? |
@JasminSAB I tried your workaround, but without success. I already have completely different IDs than |
i just removed datetimepicker-input and it works. thanks |
Hi,
and worked for me link of cnd: https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.1.2/js/tempusdominus-bootstrap-4.js |
Thank you. That should be right answer |
When I remove the value of the input field, I get an error for:
TypeError: Cannot read property 'isSame' of undefined
TypeError: Cannot read property 'clone' of undefined
It seems that it read the empty value as an error
The text was updated successfully, but these errors were encountered: