daysBetween function

int daysBetween(
  1. DateTime from,
  2. DateTime to
)

Returns the number of days between date from and to.

Implementation

int daysBetween(DateTime from, DateTime to) {
  from = DateTime(from.year, from.month, from.day);
  to = DateTime(to.year, to.month, to.day);
  return (to.difference(from).inHours / 24).round();
}