@param {string} str An [RFC 9557](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime#rfc_9557_format)-compatible string
(str = "")
| 45 | |
| 46 | /** @param {string} str An [RFC 9557](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDateTime#rfc_9557_format)-compatible string */ |
| 47 | static getParts(str = "") { |
| 48 | let dateTimeMatch = str.match(this.FULL_DATE_REGEX) ?? str.match(this.DATETIME_REGEX); |
| 49 | if(!dateTimeMatch) { |
| 50 | throw new Error(`Unsupported date format: ${str}`); |
| 51 | } |
| 52 | if(dateTimeMatch.slice(4,6).some(part => !!part?.match(this.IS_FRACTIONAL_REGEX))) { |
| 53 | throw new Error(`Unsupported date format (fractional hours or minutes): ${str}`); |
| 54 | } |
| 55 | |
| 56 | return this.getByDateTime(...dateTimeMatch); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | export class IsoDate { |