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

always says "a few seconds ago" #5

Closed
cheshire137 opened this issue Dec 11, 2013 · 3 comments
Closed

always says "a few seconds ago" #5

cheshire137 opened this issue Dec 11, 2013 · 3 comments

Comments

@cheshire137
Copy link

I can't get it to produce any output other than "a few seconds ago", even for the 1999 example. I'm using moment 2.2.1, AngularJS 1.2.1, and I initialized ng-time-relative like this:

cloudy_app = angular.module('CloudyApp', ['ngRoute', 'ngAnimate', 'ngCookies', 'angularMoment', 'ui.bootstrap', 'pascalprecht.translate', 'ui.select2', 'chieffancypants.loadingBar', 'ngSanitize', 'timeRelative'])

I tried removing angularMoment and I still only get "a few seconds ago" for %time{relative: ''} 1999.

@seidtgeist
Copy link
Owner

Have you tried putting the 1999 into the time element's datetime attribute instead?

@agzam
Copy link

agzam commented May 28, 2014

Yup, it's not working :(

I ended up using moment itself... doing something like this

{{ moment("1945", "YYYY").fromNow() }}

It's not beautiful, yet works. In order to use moment directly in the markup, moment itself needs to be exposed to the rootScope:

app.run ($rootScope)-> $rootScope.moment = moment

@janv janv closed this as completed Jun 29, 2014
@tommhuth
Copy link

tommhuth commented Apr 9, 2015

I had the same problem, though using the datetime attribute fixed it. Looks like it fails using the text content of the node.

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

5 participants