toUtc method

XPathDateTime toUtc()

Converts this date-time representation to UTC.

Implementation

XPathDateTime toUtc() {
  if (timezoneOffsetMinutes == null || timezoneOffsetMinutes == 0) {
    return this;
  }
  final dt = toDateTime();
  return XPathDateTime.fromParts(
    year: year != null ? dt.year : null,
    month: month != null ? dt.month : null,
    day: day != null ? dt.day : null,
    hour: hour != null ? dt.hour : null,
    minute: minute != null ? dt.minute : null,
    second: second != null ? dt.second : null,
    millisecond: millisecond,
    microsecond: microsecond,
    timezoneOffsetMinutes: 0,
    type: type,
  );
}