timeOfDayIsBetween, date() and british summer time is driving me nuts!


In my automations I often use timeOfDayIsBetween to detect if its between sunset and sunrise. The problem is the 3rd param which is the current time passed using date(), eg

def between = timeOfDayIsBetween(offsetBeforeSunset.sunset, offsetBeforeSunrise.sunrise, new Date(), location.timeZone)

The new Date object which the function compares the start and end times against does not have british summer time enabled… and yet the timeOfDayIsBetween function will only accept a date object for the parameter… so how do I solve this?