MCPcopy
hub / github.com/iamkun/dayjs / getDateTimeFormat

Function getDateTimeFormat

src/plugin/timezone/index.js:15–34  ·  view source on GitHub ↗
(timezone, options = {})

Source from the content-addressed store, hash-verified

13// as it is a *very* slow method.
14const dtfCache = {}
15const 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
36export default (o, c, d) => {
37 let defaultTimezone

Callers 1

makeFormatPartsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected