XPathDateTime.fromParts constructor
XPathDateTime.fromParts({})
Creates a new XPathDateTime with named components filtered for the target type.
Implementation
factory fromParts({
int? year,
int? month,
int? day,
int? hour,
int? minute,
int? second,
int millisecond = 0,
int microsecond = 0,
int? timezoneOffsetMinutes,
XPathType type = xsDateTime,
}) {
final hasYear =
type != xsTime &&
type != xsGMonthDay &&
type != xsGMonth &&
type != xsGDay;
final hasMonth = type != xsTime && type != xsGYear && type != xsGDay;
final hasDay =
type != xsTime &&
type != xsGYearMonth &&
type != xsGYear &&
type != xsGMonth;
final hasTime = type.isSubtypeOf(xsDateTime) || type == xsTime;
return XPathDateTime(
hasYear ? year : null,
hasMonth ? month : null,
hasDay ? day : null,
hasTime ? hour : null,
hasTime ? minute : null,
hasTime ? second : null,
hasTime ? millisecond : 0,
hasTime ? microsecond : 0,
timezoneOffsetMinutes,
type,
);
}