acreeger / meteor-moment Goto Github PK
View Code? Open in Web Editor NEWThis project forked from possibilities/meteor-moment
OBSOLETE - see README.md. Moment JS packaged for Meteor.
This project forked from possibilities/meteor-moment
OBSOLETE - see README.md. Moment JS packaged for Meteor.
Are reactive Moment timestamps supported? Would be great if it counted up "3 seconds ago", "4 seconds ago", etc.
it would be great to have another package, e.g. moment-twix
to add also twix.js
I tried to make a package for it, but without success. :-(
Any chance you have already foreseen to add it?
Tnx!
I see that @miraten has updated this package for Meteor 0.9+
Is there a reason why you keep the version of momentjs to 2.6? Some stuff is changing with 2.8 (especially the way i18n is handled), so I think it'd make sense to switch to the 2.8 or even 2.8.1.
Usage description reads var oneMonentPlease = moment();
Should read var oneMomentPlease = moment();
+1
hi im on windows.
tried to install moment on my meteor by cloning it into my packages folder.
when im trying to meteor add moment, it returns an error -
File not found: lib\moment\moment.js
any help?
โ moment
tag: https://github.com/acreeger/meteor-moment.git#v2.6.0
/usr/local/lib/node_modules/meteorite/lib/dependencies/package.js:106
throw('Could not locate package.js within path ' + self.source.packagePa
^
Could not locate package.js within path /Users/acamarata/.meteorite/packages/moment/acreeger/meteor-moment/26156df681750fd6e6ed77043eef32b6653ebbdf
For example: moment('Zaterdag 8 augustus 17:00', 'DD MMMM HH:mm', 'nl'), throws the following error:
TypeError: Cannot call method 'preparse' of null
W20140914-15:03:13.093(2)? (STDERR) at makeMoment (packages/mrt:moment/lib/moment/moment.js:1713)
W20140914-15:03:13.093(2)? (STDERR) at moment (packages/mrt:moment/lib/moment/moment.js:1749)
But it works fine in nodejs as a npm, it's supported since 2.0.0 so the 0.0.2 version difference shouldn't matter.
Just found https://atmosphere.meteor.com/package/moment-alternative while searching for moment (among other packages cluttering the namespace).
Looking forward to a cleaner Atmosphere ;)
I can't seem to get locale 'en-gb' working so that dates default to DD/MM/YYYY but the files seem to be missing. Looking in the packages folder (Chrome inspect source) the locales files are not listed.
Following momentjs docs I have tried (as an example), in Chrome inspect
moment.locale('fr')
< "en"
moment(1316116057189).fromNow()
< "3 years ago"
moment().locale('fr')
< Moment {_isAMomentObject: true, _isUTC: false, _pf: Object, _locale: null, _d: Fri Mar 13 2015 11:58:46 GMT+0000 (GMT)โฆ}
moment().locale()
< "en"
moment(1316116057189).fromNow()
< "3 years ago"
Is it just me or is moment.lang() not switching languages correctly?
if (moment) { moment.lang('sl'); return moment(datetime).fromNow()+" "+moment.lang(); }
returns
Friday 11.10.2013 19:57 a few seconds ago en
Probably not including the lang files from package?
using basic examples from the documentation website : http://momentjs.com/timezone/docs/
moment.tz() throws error "TypeError: n is undefined"
I have tried several approaches to get Moments to work within my Meteor install. All failed. I have no clue on why or how to proceed next. I really want this package included and working so I am asking you guys to step in and lend me a hand here?
First approach: adding the moments.js file to the project's /lib folder
So here is my directory setup within the project:
In the lib folder, I have only 1 file:
Which includes this javascript (only showing the headers here to identify):
//! moment.js
//! version : 2.6.0
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
I run Meteor 0.8.0.1.
As to the code in my application (which is a VERY basic setup just to get starting):
myapp.js contains the following javascript:
UI.registerHelper("formatDate", function(datetime){
if (moment) {
return moment(datetime).format("MM/DD/YYYY");
}
else {
return datetime;
}
});
}
In my projects template, I have this:
<template name="projectRow">
<tr class="projectRow">
<td>{{name}}</td>
<td>{{client}}</td>
<td>{{formatDate duedate}}</td>
<td>{{status}}</td>
</tr>
</template>
When I try to run this project, the server is failing to show me the formatted date, and the javascript console shows me the following errors:
As you can see, the data is not showed in the row, and obviously the browser is stumbling over code it can not interpret, as I take from the javascript console because moment is not defined.
In m.h.o. this shows that Moment is not correctly installed?
So what is missing in this setup? I went from the idea, that Moment does not need to be installed, but just needs to be in the /lib folder as a script and if that folder is in the main project folder, would be available to both server and client without any further doing? Where am I wrong here?
Second approach: install as a meteor package
As this is a Windows installation, I can not use Meteorite since that is not working on Windows yet. So, according to instructions on the Meteorite site and the Meteor site, I just mimicked the method that Meteorite does. What did I do?
First, I git cloned the package into my packages folder like this:
So that seemed to have gone well. Next, I checked my packages folder, which shows me this:
Looking in the moment folder, everything seems OK to me:
Next, I add the package to my Meteor installation by: [meteor add moment] like this:
Now, this throws some questions to me. First, it seems moment is not commenting back with something like "moments your script for nice formatting" or similar which all other packages seem to do, which has me wondering if this install even went correctly. On the other hand, there are no errors either. So. Using the command [meteor list --using] I checked what Meteor itself thinks of it:
Which makes me believe, Meteor thinks that Moment installed correctly and is using the package? True?
Now. Since I now want to use THIS package install as opposed to Approach #1, I delete the moment.js file from the /lib folder, and re-start the server with this new environment.
It reports back to me, that myapp is running:
So this seems to be all right. Not? However, when running the app in the browser, I get exactly the same error message:
Problem
I get errors either way. It seems to me, Moments did not install correctly, OR there may be incompatibility problems with Meteor 0.8.0.1. in a Windows environment or honestly, I made some huge mistake in either the installation, or maybe in my code setup.
Can someone experienced please shine his light upon this and help me out here?
Thank you in advance.
I apologize for posting here, though didn't see a git repo for the Reactive Publish package built by MRT. Where would I go to report an issue with that package? Any help would be appreciated. Thansk in advance.
Sincerely,
Chris Campbell
[email protected]
Maybe meteor admin set-unmigrated mrt:moment
to hide this package should be done. momentjs:moment
is the new "official" package which moment publishes.
Is https://github.com/acreeger/meteor-moment/blob/master/export-moment.js still needed? It's leaking 'moment' in global namespace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.