updateJustDate function

DateTime updateJustDate(
  1. DateTime newDate,
  2. DateTime originalDateTime
)

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

Implementation

DateTime updateJustDate(DateTime newDate, DateTime originalDateTime) {
  return DateTime(
    newDate.year, // year
    newDate.month, // month
    newDate.day, // day
    originalDateTime.hour, // hour
    originalDateTime.minute, // minute
    originalDateTime.second, // second
    originalDateTime.millisecond, // millisecond
    originalDateTime.microsecond, // microsecond
  );
}