Try something like:
if day(currentdate) <= 28 then
(
if month(currentdate) <= 6 then
date(year(currentdate),month(currentdate)+6, day(currentdate)) else
if month(currentdate) > 6 then
date(year(currentdate)+1, month(currentdate)-6, day(currentdate))
) else
if day(currentdate) >= 29 then
(
if month(currentdate) <= 6 then
date(year(currentdate),month(currentdate)+7, 01)-1 else
if month(currentdate) > 6 then
date(year(currentdate)+1, month(currentdate)-5, 01) -1
)
This would default to the last day of the month if the day of the month was >= 29. Not perfect, but maybe close enough?
There might be another way I haven't thought of.
-LB