I have a strange bug in my app when subtracting dates. I'm using a daterangepicker to get two dates. I'm then using this simple function:
int subDates(DateTime a, DateTime b) { return a.difference(b).inDays;}
if I select 1st March - 8th March it returns 7 days (correct) if I select 1st March - 31st March it returns 29 days (incorrect)
This only happens in March and it starts showing incorrect from the 28th day.
1st - 27th = 26 days (correct)
1st - 28th = 26 days (incorrect)