tryParseMonthDay static method

XPathDateTime? tryParseMonthDay(
  1. String value
)

Attempts to parse a string representation of a gMonthDay.

Implementation

static XPathDateTime? tryParseMonthDay(String value) {
  final match = _monthDayRegExp.firstMatch(value);
  if (match == null) return null;

  final tz = _parseTimezoneGroup(match);
  if (!tz.valid) return null;

  final mo = int.parse(match.namedGroup('month')!);
  final dy = int.parse(match.namedGroup('day')!);

  if (!_validateDateTime(1972, mo, dy, 0, 0, 0.0)) return null;

  return XPathDateTime.monthDay(mo, dy, tz.offset);
}