2 lines
1.0 KiB
JavaScript
2 lines
1.0 KiB
JavaScript
import{aK as c,aL as p,aM as u,aN as y,aO as a,aP as r,aQ as g,aR as h,aS as d,aT as l}from"./index-b5c8f851.js";function T(e){return c(e)||p(e)||u(e)}function v(e,Z){const{format:o,timeZoneOptions:n,fieldType:m}=Z??{};let i,s;if(n&&({timeZone:i,timeZoneName:s}=y(n.layerTimeZone,n.datesInUnknownTimezone,n.viewTimeZone,a(o||"short-date-short-time"),m)),typeof e=="string"&&isNaN(Date.parse(m==="time-only"?`1970-01-01T${e}Z`:e)))return e;switch(m){case"date-only":{const t=a(o||"short-date");return typeof e=="string"?l(e,{...t}):r(e,{...t,timeZone:d})}case"time-only":{const t=a(o||"short-time");return typeof e=="string"?h(e,t):r(e,{...t,timeZone:d})}case"timestamp-offset":{if(!i&&typeof e=="string"&&new Date(e).toISOString()!==e)return e;const t=o||n?a(o||"short-date-short-time"):void 0,f=t?{...t,timeZone:i,timeZoneName:s}:void 0;return typeof e=="string"?g(e,f):r(e,f)}default:{const t=o||n?a(o||"short-date-short-time"):void 0;return r(typeof e=="string"?new Date(e):e,t?{...t,timeZone:i,timeZoneName:s}:void 0)}}}export{v as N,T as Z};
|