(cacheStr: string, values: string[])
| 50 | const offsetRe = /([+-]\d\d):?(\d\d)?/; |
| 51 | |
| 52 | function calcOffset(cacheStr: string, values: string[]): number { |
| 53 | const hours = +(values[0] || 0); |
| 54 | const minutes = +(values[1] || 0); |
| 55 | // Convert seconds to minutes by dividing by 60 to keep the function return in minutes. |
| 56 | const seconds = +(values[2] || 0) / 60; |
| 57 | return (offsetCache[cacheStr] = |
| 58 | hours * 60 + minutes > 0 |
| 59 | ? hours * 60 + minutes + seconds |
| 60 | : hours * 60 - minutes - seconds); |
| 61 | } |