angular-timer icon indicating copy to clipboard operation
angular-timer copied to clipboard

Milliseconds

Open armannadim opened this issue 9 years ago • 3 comments

Hello, I'm trying to use end-time countdown. It's showing NaN when I use different time. For example:

  1. 1442241906000 -> This shows NaN
  2. 1451628000000 -> This is working. This time is taken from the example of http://siddii.github.io/angular-timer/ I've checked with thirdparty millisecond to datetime converter to check if my generated datetime is wrong or not. But this value is correct. Do you've any idea why this is happening.

Thank you

armannadim avatar Sep 07 '15 15:09 armannadim

Hi! This is an issue also for me. I tryed to conver 122 days in milliseconds and the result should be 10540800000 if one day = 86 400 000 as I found as google first answer. But if I put this in the end-time property, the timer shows 0 in every field. I arranged starting from the number in the example and now, counting 120 days left, the number that works is: 1453409000000. In which way are done the counts to have this kind of result?

angelarted avatar Sep 23 '15 13:09 angelarted

I converted 120 minutes to milliseconds and the result is 7200000 milliseconds, but when I write this result in countdown attribute I don't get the correct minutes

Sanchezdav avatar Jan 18 '17 22:01 Sanchezdav

end-time takes the epoch in milliseconds. I assume end-time is meant to always take a date in the future as a parameter, so it can be safely hard-coded most of the times (an upcoming event is unlikely to change once you put it online).

http://currentmillis.com/ Set your target date on the right panels, end-time milliseconds are calculated below the panels. The double-brackets may cause a parse bug with recent version of Angular JS, I am using 1.5.x. so beware of end-time = "{{epochMilliseconds}}", it may not work.

Should you want to calculate end-time dynamically, you'll have to perform the same operations as the aforementioned website does (milliseconds from epoch). Moment.js should allow you to do this. Maybe it's even an existing function.

bonatoc avatar Aug 10 '17 18:08 bonatoc