Help; make days since X command (NIGHTBOT)

Hi! I am trying to set up a command that counts the days since last PB, but can’t figure out how to set it up with a customized output in the form of only stating the days since.

I have done:
!addcom !lastpb It has been $(countup Jan 06 2022 America/Los_Angeles) since last PB

However the output of this is:
“It has been 6 months 13 days 6 hours 35 minutes since last PB”
Whereas I want the command’s output to have the time-format of “It has been 194 days since last PB”

Does anyone know how to set this up? It doesn’t have to be based off my original command in any way, I just want it to be formatted as only counting days hehe

Thank you!

On the Nightbot docs i looked up “time
and I found “countup” variables. Perhaps this count help you?
https://docs.nightbot.tv/variables/countup

I used the days since Christmas example:

!commands add !pb It has been days since last pb $(countup Dec 25 2014 12:00:00 AM EST)

Screenshot 2022-07-20 08.37.33
The wording could be changed around a bit to make more sense but it does work. :slight_smile:

Hey @cupeidei!

This isn’t possible because of how the library used under the hood does things.

What we usually do is cut the response in categories, then multiply each value by a “magic” number (called magic because they’re “arbitrary,” static and will generate erroneous conversions: a month has between 28 and 31 days, a year is either 365 or 366 days, that’s difficult to keep up with).
You can see an example of a similar command here, but for them it works because they wouldn’t stream for more than a day or so, they don’t reach months.

That’s my bad I didn’t read this properly at all :grimacing: Sorry

I hope this works.

It has been $(eval d = new Date('1/6/2022'); $(urlfetch json https://pastebin.com/raw/w4qiZbX0)) days since last PB
1 Like

That’s a good suggestion! I wanted to try something similar, but I didn’t have time.
It will work properly with the following fixes:

  • have the date under the format: YYYY/MM/DD
  • substract 1 to the result

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