tryParseMonth static method

XPathDateTime? tryParseMonth(
  1. String value
)

Attempts to parse a string representation of a gMonth.

Implementation

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

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

  final mo = int.parse(match.namedGroup('month')!);
  if (mo < 1 || mo > 12) return null;

  return XPathDateTime.month(mo, tz.offset);
}