| 110 | const offsetFormatterCache = new Map<string, Intl.DateTimeFormat>(); |
| 111 | |
| 112 | function getPartsFormatter(timezone?: string): Intl.DateTimeFormat { |
| 113 | const key = timezone ?? ''; |
| 114 | let formatter = partsFormatterCache.get(key); |
| 115 | if (!formatter) { |
| 116 | const dftOptions: Intl.DateTimeFormatOptions = { |
| 117 | year: 'numeric', |
| 118 | month: '2-digit', |
| 119 | day: '2-digit', |
| 120 | hour: '2-digit', |
| 121 | minute: '2-digit', |
| 122 | second: '2-digit', |
| 123 | weekday: 'short', |
| 124 | hour12: false |
| 125 | } |
| 126 | |
| 127 | if(timezone){ |
| 128 | dftOptions.timeZone = timezone; |
| 129 | } |
| 130 | |
| 131 | formatter = new Intl.DateTimeFormat('en-US', dftOptions); |
| 132 | partsFormatterCache.set(key, formatter); |
| 133 | } |
| 134 | return formatter; |
| 135 | } |
| 136 | |
| 137 | function getOffsetFormatter(timezone?: string): Intl.DateTimeFormat { |
| 138 | const key = timezone ?? ''; |