I don't see any immediate problems with that code, other than the extra comma's that should give you an error anyway, so this could be a bug. I suggest filing a ticket.
If you don't care about the time parts of those attributes at all, you could save and retrieve those dates using trim-to functions
Yup, sorry, the commas weren't suppose to be in there. I'll use the trimToDay function to create a variable and a second one with trimToDays and addDays function and use:
$DateStart <= DateTimeAttr < $NextDate