(timezone?: string)
| 135 | } |
| 136 | |
| 137 | function getOffsetFormatter(timezone?: string): Intl.DateTimeFormat { |
| 138 | const key = timezone ?? ''; |
| 139 | let formatter = offsetFormatterCache.get(key); |
| 140 | if (!formatter) { |
| 141 | formatter = new Intl.DateTimeFormat('en-US', { |
| 142 | timeZone: timezone, |
| 143 | timeZoneName: 'shortOffset' |
| 144 | }); |
| 145 | offsetFormatterCache.set(key, formatter); |
| 146 | } |
| 147 | return formatter; |
| 148 | } |
| 149 | |
| 150 | function buildDateParts(date: Date, timezone?: string): DateParts { |
| 151 | const dateFormat = getPartsFormatter(timezone); |