addDaysAndSetHHMM static method

DateTime addDaysAndSetHHMM(
  1. DateTime ref,
  2. int days,
  3. String hhColonMM
)

Adds days to a reference date and sets the time to the specified HH:MM.

Parameters:

  • ref: Reference DateTime
  • days: Number of days to add
  • hhColonMM: Time in "HH:MM" format

Returns a new DateTime with added days and specified time (seconds and milliseconds set to 0).

Implementation

static DateTime addDaysAndSetHHMM(DateTime ref, int days, String hhColonMM) {
  var timeOfDay = parseHHColonMMToTimeOfDay(hhColonMM);
  return ref.add(Duration(days: days)).copyWith(
      hour: timeOfDay.hour,
      minute: timeOfDay.minute,
      second: 0,
      millisecond: 0);
}