Variables: Time to / Countdown

Is ist possible to create a Nightbot command (Youtube) to show a time TO a date, maybe like time to Christmas:
!addcom !Christmas Time to Christmas: $(countdown Dec 24 2015 12:00:00 PM EST)
The problem is the year (in this example 2015) and I dont want to update it every year. When I dont write the year, Nightbot says … years … months … days … hours … minutes … seconds ago.
Is there a way to make Nightbot saying “Its … months … days … hours … minutes … seconds to Christmas”?
Thanks before :slight_smile:


Christmas countdown:

!addcom -cd=5 !christmas There are $(countdown 12 25 $(eval a=new Date;if(a.getMonth()>11){c=a.getFullYear()+1;}else{c=a.getMonth()==11&&a.getDate()>=25?a.getFullYear()+1:a.getFullYear();}c) 00:00:00 EST) left until Christmas!

More general use. Replace MONTH with the number of your month (1 for January, 4 for April, etc.) and DAY with the day of the month (2 for the second day, 15 for the fifteenth day, etc.):

!addcom -cd=5 !countdown There are $(countdown MONTH DAY $(eval a=new Date;if(a.getMonth()>MONTH-1){c=a.getFullYear()+1;}else{c=a.getMonth()==MONTH-1&&a.getDate()>=DAY?a.getFullYear()+1:a.getFullYear();}c) 00:00:00 EST) left until MONTH/DAY!
1 Like

Thank you so much! :+1:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.