Comments (11)
It seems like this is the culprit:
if (typeof moment.tz !== "function") {
throw new Error("If you specify a timezoneId, make sure that you've added a moment-timezone package to your app");
}
The condition is evaluating to true and throwing up that error, but on the console, I get this:
> typeof moment.tz
"function"
So it must be a loading order issue, but I'm a little out of my depth on that. Appreciate any pointers.
from meteor-autoform-bs-datetimepicker.
I'm not sure other than agreeing it's probably due to loading order. Typically I would expect all packages to be loaded before anything would be setting autoform input values.
You might try editing your packages file and moving mrt:moment-timezone to somewhere near the top.
I think I didn't list any moment-timezone dependencies because you could add it in a lot of ways, but we could add a weak dependency if this becomes a problem. I was kind of waiting to see if there would eventually be an official package, as there now is for moment.
from meteor-autoform-bs-datetimepicker.
Tried putting it at the very top of packages
, same thing though. I'm thinking it could also be some sort of scope issue.
I'll try adding mrt:moment-timezone
as a dependency in a local fork of meteor-autoform-bs-datetimepicker
and see if that helps.
from meteor-autoform-bs-datetimepicker.
I'm getting this same error but only on my update form, insert form is fine.
from meteor-autoform-bs-datetimepicker.
OK, if I have the schema set with type: string and a timezoneId, the fields show up in my update form but I get this warning in the console and the data is not displayed.
"Deprecation warning: moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to moment/moment#1407 for more info."
If the schema is set with type: date and a timezoneId, the fields do not show up and I get:
Error: Exception in template helper:
Error: If you specify a timezoneId, make sure that you've added a moment-timezone package to your app
at Object.dateToNormalizedLocalDateAndTimeString (utility.js:411)
at Object.AutoForm.addInputType.valueIn (autoform-bs-datetimepicker.js:12)
at getInputValue (autoform-inputs.js:205)
at Object.afFieldInputContext (afFieldInput.js:67)
at bindDataContext (lookup.js:26)
at Blaze._wrapCatchingExceptions (exceptions.js:51)
at Spacebars.call (spacebars-runtime.js:130)
at Spacebars.mustacheImpl (spacebars-runtime.js:67)
at Object.Spacebars.dataMustache (spacebars-runtime.js:99)
at afFieldInput.html:9
in the console.
from meteor-autoform-bs-datetimepicker.
OK, tracked it down to multiple moment packages being installed.
from meteor-autoform-bs-datetimepicker.
I also get this error as sheldonkotyk at the same location.
Besides mrt:moment and mrt:moment-timezone I had the momentjs:moment package included.
However, removing this has not solved the issue. @sheldonkotyk how did you resolve this issue?
BR, Carsten
from meteor-autoform-bs-datetimepicker.
Same here.
Interestingly @ http://localhost:3000/packages/aldeed_autoform-bs-datetimepicker.js
Line 75
if (typeof moment.tz !== "function") {
IS OK
whereas:
http://localhost:3000/packages/aldeed_autoform.js
The next function called, FAILS:
AutoForm.addInputType("bootstrap-datetimepicker",
Line 474 if (typeof m.tz !== "function") {
from meteor-autoform-bs-datetimepicker.
@came, @gekosurf, @obvio171 I think this should be fixed in v1.0.6. I added weak dependencies on the moment packages. Can someone confirm?
from meteor-autoform-bs-datetimepicker.
I'm still running into this issue in the newest version. The only moment packages that I have installed are:
mrt:moment
mrt:moment-timezone.
Getting the same error mentioned at the top of the thread.
from meteor-autoform-bs-datetimepicker.
I published an updated version of mrt:moment-timezone
as aldeed:moment-timezone
. If you switch to aldeed:moment-timezone
, these load order issues should be resolved.
from meteor-autoform-bs-datetimepicker.
Related Issues (20)
- Using reactive variable to set date on timepicker, but date doesn't show. HOT 1
- Type:Number is not working HOT 2
- interval settings on timepicker don't work with v. 3.1.3_3 of tsega:bootstrap3-datetimepicker HOT 1
- When bootstrap navbar present, date picker appears above and off the screen. HOT 1
- Incompatibility with tsega:bootstrap3-datetimepicker@4 and above HOT 7
- Value will be reset after validation problem HOT 2
- Show debug on browser console "dtp.setDate is not a function"? HOT 4
- upgrade bootstrap to later version in the package 4.17.37 HOT 5
- Reset issue while adding new datetime field in a form. HOT 1
- customizing HOT 2
- gooseman implementation throws an Error: datetimepicker component should be placed within a relative positioned container HOT 1
- datepicker set date dynamic value HOT 1
- getDate() in undefined HOT 3
- currentDate not sets the correct date, but alway 12:00 am HOT 1
- UTC Time HOT 1
- timezoneId doesn't work HOT 1
- Wrong moment-timezone package HOT 1
- Could update to last of datetimepicker? HOT 1
- LT format not supported HOT 3
- Update moment packages to use NPM HOT 1
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 meteor-autoform-bs-datetimepicker.