Countup Format to Show Weeks and Days

I’m curious if there’s a way to make countup show in a years/months/weeks/days/hours/minutes/seconds format. Right now it just shows in a years/months/days/hours/minutes/seconds format. Thanks.

@runecrowx

Replace DATE with the date you are counting up from.

$(eval a=`$(countup DATE)`;m=a.match(/\d+ days?/);d=m?parseInt(m[0].split(` `)[0]):0;w=d?Math.floor(d/7):0;m&&w?a.replace(m[0],w+` week${w>1?`s`:``} `+m[0].replace(d,d-7*w)):a)
1 Like

Thank you! That was very helpful. :slight_smile:

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