@param {RegExpMatchArray} match
( _, // full match year = "", month = "0", // 0-indexed default day = "1", // 1-indexed default hours = "0", minutes = "0", seconds = "0", milliseconds = "0", timezone = "Z", )
| 19 | |
| 20 | /** @param {RegExpMatchArray} match */ |
| 21 | static getByDateTime( |
| 22 | _, // full match |
| 23 | year = "", |
| 24 | month = "0", // 0-indexed default |
| 25 | day = "1", // 1-indexed default |
| 26 | hours = "0", |
| 27 | minutes = "0", |
| 28 | seconds = "0", |
| 29 | milliseconds = "0", |
| 30 | timezone = "Z", |
| 31 | ) { |
| 32 | let offset = this.getTimezoneOffset(timezone); |
| 33 | |
| 34 | return { |
| 35 | year: parseInt(year, 10), |
| 36 | month: parseInt(month, 10) - 1, |
| 37 | day: parseInt(day, 10), |
| 38 | hours: parseInt(hours, 10) - offset.hours, |
| 39 | minutes: parseInt(minutes, 10) - offset.minutes, |
| 40 | seconds: parseInt(seconds, 10), |
| 41 | // may include extra precision but we only count the first 3 digits for milliseconds |
| 42 | milliseconds: parseInt(milliseconds.slice(0, 3), 10), |
| 43 | }; |
| 44 | } |
| 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 = "") { |
no test coverage detected