siddii / angular-timer

re-usable/inter-operable AngularJS timer directive ⛺
http://siddii.github.io/angular-timer/
MIT License
792 stars 938 forks source link

start-time not working #104

Open cgetner-zz opened 10 years ago

cgetner-zz commented 10 years ago

Trying to display a time since a user took a specific action.

If I put in a constant value for start-time the timer works. If I put in a variable the timer always starts at zero every time the page loads.

{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.
programming-kid commented 9 years ago

i get this same error with end-time but start-time works fine

<h3> Start : 
<timer start-time="event.start">
     {{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.
  </timer>
</h3>
<h3>
End : <timer end-time="event.end">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer>
</h3>
$scope.event.start = "2014-12-11T20:30:36.914Z"
$scope.event.end = "2014-12-30T18:30:00.000Z"

end-time works fine if value is hard-coded in controller but not if it is loaded from server async

thanks

JehandadK commented 9 years ago

Same here, tried using a function as well as a variable which I manually update. But nothing works. Even static values dont work.

ruelluna commented 9 years ago

Me three.. I was configuring how to store the timer value using localStorage so that when the page reloads, the timer will still at the second the page was refreshed. But setting the time on 'start-time' didn't work either. Who's here to help?

joebordes commented 9 years ago

Have you tried this change?

https://github.com/joebordes/angular-timer/commit/0229d84493c8e47a8e98ab430ad67124327bd92f

it seems to work for me....

ruelluna commented 9 years ago

@joebordes, doesn't seem to work on my end..

joebordes commented 9 years ago

Have a look at the plunkr I created:

http://plnkr.co/edit/4QeZYsgDcxpkvgUjgHL6?p=preview

that is the current code of angular-timer and the time does not set by code, fork it, add my change to the timer.js file and try again.

It seems to be working for me. I had a problem whereas I was setting the time only but you have to set the full date.

HTH

joebordes commented 9 years ago

BTW, the issue is here: https://github.com/siddii/angular-timer/issues/194