Comments (5)
Turns out the problem was in what I put in my controller's scope.
These 2 lines worked:
$scope.minDate = new Date();
However when I replaced the above with simply tomorrow's date (at time of posting the local date is July 9, 2015):
$scope.minDate = new Date(2015, 7 - 1, 10);
I get these two errors:
TypeError: scope.minDate.clone is not a function
at optimize (quantumui.js:2780)
at Object.angular.module.run.provider.$get.$picker.init (quantumui.js:2519)
at quantumui.js:4277
at processQueue (angular.js:14551)
at angular.js:14567
at Scope.$get.Scope.$eval (angular.js:15830)
at Scope.$get.Scope.$digest (angular.js:15641)
at Scope.$get.Scope.$apply (angular.js:15935)
at bootstrapApply (angular.js:1624)
at Object.invoke (angular.js:4443)
(anonymous function) @ angular.js:12314
$get @ angular.js:9101
processQueue @ angular.js:14559
(anonymous function) @ angular.js:14567
$get.Scope.$eval @ angular.js:15830
$get.Scope.$digest @ angular.js:15641
$get.Scope.$apply @ angular.js:15935
bootstrapApply @ angular.js:1624
invoke @ angular.js:4443
doBootstrap @ angular.js:1622
bootstrap @ angular.js:1642
angularInit @ angular.js:1536
(anonymous function) @ angular.js:28289
jQuery.Callbacks.fire @ jquery.js:3148
jQuery.Callbacks.self.fireWith @ jquery.js:3260
jQuery.extend.ready @ jquery.js:3472
completed @ jquery.js:3503
TypeError: Cannot read property 'clone' of undefined
at quantumui.js:3070
at apply (quantumui.js:3176)
at Object.fn (quantumui.js:3069)
at Scope.$get.Scope.$digest (angular.js:15667)
at Scope.$get.Scope.$apply (angular.js:15935)
at bootstrapApply (angular.js:1624)
at Object.invoke (angular.js:4443)
at doBootstrap (angular.js:1622)
at bootstrap (angular.js:1642)
at angularInit (angular.js:1536)
Apparently, setting the scope variable of minDate to a value that is NOT today causes this error.
*This appears to be a bug in the datepicker *
from quantumui.
You must use moment instead of Date object; here is moment documentation
from quantumui.
Understood... thanks for the clarification.
My suggestion is the datepicker should detect
that Date
is used and silently convert to moment
. This would allow the users to have the flexibility of using either format. I absentmindedly used Date
because the documentation didn't say we had to (while it does say you need moment.js for datepicker, it does not say that all dates for the datepicker have to be moment objects).
However, the real problem (bug?) is why is the datepicker even looking at my $scope.minDate
?
If it is using it as a 'master' setting for all datepickers then it should be using the 'config' mechanism. Nowhere in the documentation do I see a mention that the $scope.minDate is used by the datepicker.
Otherwise, how would I be able to set the min date separately for each datepicker ?
-David
from quantumui.
Hi David,
Thank you for your clear suggestion.
I found the reason. Currently, we detect string
, when setted as optioin. Beacuse when it setted as object(Date or moment) it required to cloned. I will update it in next release.
Also, $datepickerProvider
has already config mechanism and each picker has own options.
from quantumui.
Currently you have two alternative to resolve your case;
- Set minDate as string:
$scope.minData = moment().format('yourformat')
- Change the source code:
replace this line
scope.minDate = moment(options.minDate, options.format);
with
scope.minDate = angular.isString(options.minDate) ? moment(options.minDate, options.format) : angular.isDate(options.minDate) ? moment(options.minDate) : moment.isMoment(options.minDate) ? options.minDate.clone():moment();
Also it should be updated for maxDate and startDate too.
from quantumui.
Related Issues (20)
- drag items inside the grid
- Select Multiple, Modal
- $loading in a service with timeout=false HOT 2
- aside incompatible with view routing?
- nqModal onhide event HOT 1
- About the version tag HOT 3
- nq-dropdown remains open after selecting a menu item.
- timepicker container doesn't show the correct time
- click on a tooltiped element does not blur focused input
- nqSelect issue on IE
- Preselect some option using the select directive
- nqDropdown : template
- Site Down HOT 4
- improve docs nqPopover (programmatically) HOT 5
- nqSelect does not work properly
- Datepicker: cannot clear input value
- Pageable licence HOT 1
- Modal: Is it possible to inject its own controller? HOT 1
- Auto close dropdown on 'lost focus'
- Version inconsistent HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quantumui.