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

Countdown Mode, Wrong End date #57

Closed
satyasaadhak opened this issue Dec 17, 2018 · 2 comments
Closed

Countdown Mode, Wrong End date #57

satyasaadhak opened this issue Dec 17, 2018 · 2 comments

Comments

@satyasaadhak
Copy link

satyasaadhak commented Dec 17, 2018

I am using the v2.4.0 of the library since I am getting errors in the latest one. I've set the target date to 25 December 2018, I want it to countdown from current time.

var today = new Date();
var date = new Date('December 25, 2018');

var timer = new Timer();
timer.start({countdown:true, startValues:{days:today.getDay(),hours:today.getHours(), minutes:today.getMinutes(), seconds:today.getSeconds()}, target:{days:date.getDay(),hours:date.getHours(), minutes:date.getMinutes(), seconds:date.getSeconds()}});
timer.addEventListener('secondsUpdated', function (e) {
    $('#sale-countdown .days').html(timer.getTimeValues().days);
    $('#sale-countdown .hours').html(timer.getTimeValues().hours);
    $('#sale-countdown .minutes').html(timer.getTimeValues().minutes);
    $('#sale-countdown .seconds').html(timer.getTimeValues().seconds);
});

I am getting the wrong end date. What am I doing wrong?

The v3.0.0 was throwing a Timer() is not defined error BTW. Also, VS Code was showing an error in the min file.

@satyasaadhak
Copy link
Author

My bad, this was an issue with wrong understanding of JavaScript's Date class. Nothing to do with the library. Apologies!

@albert-gonzalez
Copy link
Owner

albert-gonzalez commented Dec 17, 2018

No problem :)

BTW, in v3.0.0, the way that the library is imported has changed. You have a migration guide if you want to use this version: https://github.com/albert-gonzalez/easytimer.js/blob/master/MIGRATION.md.

Best Regards!

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

2 participants