(+month) doesnt work on the 31st

Hey guys,

Ive noticed today (the 31st) that the + month doesnt work if the current day is on the 31st. The calculation seems to skip over other months.

Im thinking either:
A) the calculation only will move to the next month that also has 31 days
B) the calculation adds 30 days and takes the month at that time. The problem is you can skip over february or hit the same month twice.

By subtracting 1 month today Ive been getting the following results
Current date (format as mmm): May
Current date +month -1: May
Current date +month -2: Mar
Current date +month -3: Jan

Also below is a screenshot of some buttons that show the previous month, this month and next month using the (+month) setting. It shows May, May, July on May 31st.

We use the Javascript native stuff, so not sure we should overwrite that. If that’s a big issue, please file a bug report.

2 Likes

I made a small app to show which days the calculation is off:

Looks like it is off on the 30th and 31st of the month as the calculation will skip over months that do not also have 30 or 31 days.

A simple work around is to first set the day to a number other than 30 or 31 before using the +(month) calculation (set day to 10 for example).

I am running in to problems with 31st dates also… This filter in this example is causing it to look for dates greater than 05/30 instead of 05/31 so it’s throwing bad data.

2 Likes

Hey craig,

remember that date comparisons include the time of the day, not just the date itself. I would change your calculation to be:

Interaction date > min interaction dat’s value + (days) -1 change hours to 23 change minutes to 59

1 Like

It’s actually a hard problem, and I’m not sure we want to hack something different from JS does.

if you want to be safe, you should change the day (if the goal is just to have months).

3 Likes

Thanks I’ll give it a try!