For anyone who might still be interested, I use the following
isLastDayOfMonth() =>
last_day = str.format_time(time_close("1M"), "yyyy-MM-dd", syminfo.timezone)
this_day = str.format_time(time, "yyyy-MM-dd", syminfo.timezone)
this_day == last_day