Time constructor

Time(
  1. DateTime dateTime
)

Creates a Time from a DateTime, stripping all date components and converting to UTC. If the input DateTime is not in UTC, it will be converted automatically.

The resulting Time will be in UTC, regardless of the input DateTime's timezone.

Implementation

Time(DateTime dateTime)
    : _dateTime = dateTime.toUtc()._let(
            (dt) => DateTime.utc(
              0,
              1,
              1,
              dt.hour,
              dt.minute,
              dt.second,
            ),
          );