LocalDateTime constructor

LocalDateTime(
  1. LocalDate date,
  2. LocalTime time
)

Combines a date and time, normalizing 24:00 to the next midnight.

Implementation

factory LocalDateTime(LocalDate date, LocalTime time) {
  if (time.hour == 24) {
    date = date.addDays(1);
    time = LocalTime(0);
  }
  if (date.julianDay > maxJulianDay) {
    throw RangeError(
      'Local timestamp exceeds the finite PostgreSQL TIMESTAMP range.',
    );
  }
  return LocalDateTime._(date, time);
}