{"version":3,"sources":["../src/iso8601.ts"],"sourcesContent":["/**\n * Matches a given date with ISO 8601 compliance. Allows the \"T\" to be missing\n * and only requires year and month, other params are required with increasing\n * specificity. Supports timezone offsets with optional seconds (e.g., +05:32:11).\n */\nexport const iso8601Match =\n  /^([0-9]{4})-([0-1][0-9])(?:-([0-3][0-9]))?(?:[T ]?([0-2][0-9])(?::([0-5][0-9]))?(?::([0-5][0-9]))?)?(?:\\.[0-9]+)?(Z|(?:\\+|\\-)[0-9]{2}:?[0-9]{2}(?::?[0-9]{2})?)?$/\n\n/**\n * True when the date string is valid ISO 8601.\n * @param date - A date string.\n */\nexport function iso8601(date: string): boolean {\n  const matches = date.match(iso8601Match)\n  if (matches) {\n    const month = Number(matches[2])\n    if (month < 1 || month > 12) return false\n\n    if (typeof matches[3] !== undefined) {\n      const date = Number(matches[3])\n      if (date < 1 || date > 31) return false\n    }\n    if (typeof matches[4] !== undefined) {\n      const hours = Number(matches[4])\n      if (hours < 0 || hours > 23) return false\n    }\n\n    return true\n  }\n  return false\n}\n"],"mappings":";AAKO,IAAM,eACX;AAMK,SAAS,QAAQ,MAAuB;AAC7C,QAAM,UAAU,KAAK,MAAM,YAAY;AACvC,MAAI,SAAS;AACX,UAAM,QAAQ,OAAO,QAAQ,CAAC,CAAC;AAC/B,QAAI,QAAQ,KAAK,QAAQ,GAAI,QAAO;AAEpC,QAAI,OAAO,QAAQ,CAAC,MAAM,QAAW;AACnC,YAAMA,QAAO,OAAO,QAAQ,CAAC,CAAC;AAC9B,UAAIA,QAAO,KAAKA,QAAO,GAAI,QAAO;AAAA,IACpC;AACA,QAAI,OAAO,QAAQ,CAAC,MAAM,QAAW;AACnC,YAAM,QAAQ,OAAO,QAAQ,CAAC,CAAC;AAC/B,UAAI,QAAQ,KAAK,QAAQ,GAAI,QAAO;AAAA,IACtC;AAEA,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":["date"]}