| 13 | // as it is a *very* slow method. |
| 14 | const dtfCache = {} |
| 15 | const getDateTimeFormat = (timezone, options = {}) => { |
| 16 | const timeZoneName = options.timeZoneName || 'short' |
| 17 | const key = `${timezone}|${timeZoneName}` |
| 18 | let dtf = dtfCache[key] |
| 19 | if (!dtf) { |
| 20 | dtf = new Intl.DateTimeFormat('en-US', { |
| 21 | hour12: false, |
| 22 | timeZone: timezone, |
| 23 | year: 'numeric', |
| 24 | month: '2-digit', |
| 25 | day: '2-digit', |
| 26 | hour: '2-digit', |
| 27 | minute: '2-digit', |
| 28 | second: '2-digit', |
| 29 | timeZoneName |
| 30 | }) |
| 31 | dtfCache[key] = dtf |
| 32 | } |
| 33 | return dtf |
| 34 | } |
| 35 | |
| 36 | export default (o, c, d) => { |
| 37 | let defaultTimezone |