updateJustTime function

DateTime updateJustTime(
  1. TimeOfDay newTime,
  2. DateTime originalDateTime
)

Given a DateTime this will replace just the time portion leaving the date unchanged

Implementation

DateTime updateJustTime(TimeOfDay newTime, DateTime originalDateTime) {
  return DateTime(
    originalDateTime.year, // year
    originalDateTime.month, // month
    originalDateTime.day, // day
    newTime.hour, // hour
    newTime.minute, // minute
    0, // second
    0, // millisecond
    0, // microsecond
  );
}