Last month backup listed as This month

Hello,
I think there’s a mistake in ‘This month’ list, it also shows a backup made on July 29th
(we are in August)
image

1 Like

I agree with you but also there is bug with “This week” (I see backups created at the prev. week).

I’m guessing “this month” means “within the past 30 days”, and “this week” means “within the past 7 days”. That’s what it looks like on my system anyway. “Today” and “Yesterday” seems to be only those calendar days, though. So it’s either a bug or at minimum incorrect labeling.

Code is below, for anyone who reads JavaScript well (I do not) or (even better) wants to improve it:

Seems more or less right based on the now.getDate() - 7 seeming to go back 7 days from now.
JavaScript seemingly gives no direct support for going back by weeks, although it does for months.
Month adjust looks rough due to trying to use the same day of month despite varied month lengths.
August and July both have 31 days though, so that might not explain how July 29 wound up in Aug.

Yeah, that’s pretty simple date processing but for most situations it’s probably not a huge issue. Keep in mind this should only be a display issue in the GUI.

A few loops and a couple statements (or put it all in a function) could clean it up pretty quickly.

var daysInMonth = 0
var shortMonths = [Feb,Apr,Jul,Aug,Oct,Dec]
var longMonths = [Jan,Mar,May,Jun,Sep,Nov]
for each (month in shortMonths){if month = thismonth{daysInMonth = 30} ...extra processing for Feb ie.28 or 29}
same for each loop for longMonths
if (daysInMonth == 0){console.log(WTF?)}
var daysRemaining = today - daysInMonth
adjust dateBuckets to match

That’s Sunday morning, untested, pseudo code while I drink my tea so don’t expect the above to work (I doubt I could just subtract daysInMonth from today directly for example) but these would be some of the steps towards making the date more accurate.