{"version":3,"file":"DateTimeDisplay.IBbWs4_e.mjs","names":["useState","useMemo","formatted"],"sources":["https:/framerusercontent.com/modules/niBIr91kklpkDJAsT1Je/V8vnz32STaIioiD0rBYs/DateTimeDisplay.js"],"sourcesContent":["// Date Time component with customizable format, locale, and font properties\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useMemo,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Date Time component with customizable format, locale, and font properties\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DateTimeDisplay(props){const{timezone=\"auto\",showSeconds=false,showTimeZone=false,timeFormat=\"12\",caseFormat=\"upper\",fontColor=\"#7E7E7E\",font,prefix=\"\",suffix=\"\",textSelectable=true,locale=\"en-US\",useCustomFormat=false,customFormat=\"YYYY-MM-DD HH:mm:ss\",style}=props;const[currentTime,setCurrentTime]=useState(new Date);useEffect(()=>{const interval=setInterval(()=>{startTransition(()=>{setCurrentTime(new Date);});},showSeconds?1e3:6e4);return()=>clearInterval(interval);},[showSeconds]);const formattedDateTimeDisplay=useMemo(()=>{try{if(useCustomFormat&&customFormat){// Custom format implementation\nconst formatCustom=(date,format)=>{const year=date.getFullYear();const month=date.getMonth()+1;const day=date.getDate();const hours=date.getHours();const minutes=date.getMinutes();const seconds=date.getSeconds();const hours12=hours%12||12;const ampm=hours>=12?\"PM\":\"AM\";const weekdays=[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"];const weekdaysShort=[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"];const months=[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"];const monthsShort=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];return format.replace(/YYYY/g,year.toString()).replace(/YY/g,year.toString().slice(-2)).replace(/MMMM/g,months[month-1]).replace(/MMM/g,monthsShort[month-1]).replace(/MM/g,month.toString().padStart(2,\"0\")).replace(/M/g,month.toString()).replace(/DD/g,day.toString().padStart(2,\"0\")).replace(/D/g,day.toString()).replace(/dddd/g,weekdays[date.getDay()]).replace(/ddd/g,weekdaysShort[date.getDay()]).replace(/HH/g,hours.toString().padStart(2,\"0\")).replace(/H/g,hours.toString()).replace(/hh/g,hours12.toString().padStart(2,\"0\")).replace(/h/g,hours12.toString()).replace(/mm/g,minutes.toString().padStart(2,\"0\")).replace(/m/g,minutes.toString()).replace(/ss/g,seconds.toString().padStart(2,\"0\")).replace(/s/g,seconds.toString()).replace(/A/g,ampm).replace(/a/g,ampm.toLowerCase());};let formatted=formatCustom(currentTime,customFormat);// Apply case formatting\nswitch(caseFormat){case\"upper\":formatted=formatted.toUpperCase();break;case\"lower\":formatted=formatted.toLowerCase();break;case\"title\":formatted=formatted.replace(/\\b\\w/g,l=>l.toUpperCase());break;}return`${prefix}${formatted}${suffix}`;}const options={weekday:\"short\",day:\"2-digit\",month:\"short\",hour:\"2-digit\",minute:\"2-digit\",hour12:timeFormat===\"12\",timeZone:timezone===\"auto\"?undefined:timezone};if(showSeconds){options.second=\"2-digit\";}if(showTimeZone){options.timeZoneName=\"short\";}let formatted=currentTime.toLocaleString(locale,options);// Apply case formatting\nswitch(caseFormat){case\"upper\":formatted=formatted.toUpperCase();break;case\"lower\":formatted=formatted.toLowerCase();break;case\"title\":formatted=formatted.replace(/\\b\\w/g,l=>l.toUpperCase());break;}return`${prefix}${formatted}${suffix}`;}catch(error){// Fallback formatting if locale/timezone is invalid\nconst fallback=currentTime.toLocaleString(\"en-US\",{weekday:\"short\",day:\"2-digit\",month:\"short\",hour:\"2-digit\",minute:\"2-digit\",hour12:timeFormat===\"12\"});return caseFormat===\"upper\"?fallback.toUpperCase():fallback;}},[currentTime,timezone,showSeconds,showTimeZone,timeFormat,caseFormat,prefix,suffix,locale,useCustomFormat,customFormat]);const isFixedWidth=style?.width===\"100%\";return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",color:fontColor,userSelect:textSelectable?\"text\":\"none\",cursor:textSelectable?\"text\":\"default\",...isFixedWidth?{}:{width:\"max-content\"},...font},children:formattedDateTimeDisplay});}addPropertyControls(DateTimeDisplay,{useCustomFormat:{type:ControlType.Boolean,title:\"Custom Format\",defaultValue:false,enabledTitle:\"Custom\",disabledTitle:\"Preset\"},customFormat:{type:ControlType.String,title:\"Format String\",defaultValue:\"YYYY-MM-DD HH:mm:ss\",placeholder:\"e.g., YYYY-MM-DD HH:mm:ss\",hidden:({useCustomFormat})=>!useCustomFormat},timezone:{type:ControlType.Enum,title:\"Time Zone\",options:[\"auto\",\"America/New_York\",\"America/Chicago\",\"America/Denver\",\"America/Los_Angeles\",\"Europe/London\",\"Europe/Paris\",\"Europe/Berlin\",\"Asia/Tokyo\",\"Asia/Shanghai\",\"Asia/Kolkata\",\"Australia/Sydney\",\"UTC\"],optionTitles:[\"Auto (Local)\",\"New York (EST/EDT)\",\"Chicago (CST/CDT)\",\"Denver (MST/MDT)\",\"Los Angeles (PST/PDT)\",\"London (GMT/BST)\",\"Paris (CET/CEST)\",\"Berlin (CET/CEST)\",\"Tokyo (JST)\",\"Shanghai (CST)\",\"Mumbai (IST)\",\"Sydney (AEST/AEDT)\",\"UTC\"],defaultValue:\"auto\",hidden:({useCustomFormat})=>useCustomFormat},showSeconds:{type:ControlType.Boolean,title:\"Seconds\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\",hidden:({useCustomFormat})=>useCustomFormat},showTimeZone:{type:ControlType.Boolean,title:\"Time Zone\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\",hidden:({useCustomFormat})=>useCustomFormat},timeFormat:{type:ControlType.Enum,title:\"Mode\",options:[\"12\",\"24\"],optionTitles:[\"12 Hour\",\"24 Hour\"],defaultValue:\"12\",displaySegmentedControl:true,hidden:({useCustomFormat})=>useCustomFormat},caseFormat:{type:ControlType.Enum,title:\"Case\",options:[\"upper\",\"lower\",\"title\"],optionTitles:[\"UPPER\",\"lower\",\"Title\"],defaultValue:\"upper\"},fontColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#7E7E7E\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"0em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"Text before...\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"Text after...\"},locale:{type:ControlType.Enum,title:\"Locale\",options:[\"en-US\",\"en-GB\",\"fr-FR\",\"de-DE\",\"es-ES\",\"it-IT\",\"ja-JP\",\"ko-KR\",\"zh-CN\",\"zh-TW\",\"pt-BR\",\"ru-RU\",\"ar-SA\",\"hi-IN\"],optionTitles:[\"English (US)\",\"English (UK)\",\"French\",\"German\",\"Spanish\",\"Italian\",\"Japanese\",\"Korean\",\"Chinese (Simplified)\",\"Chinese (Traditional)\",\"Portuguese (Brazil)\",\"Russian\",\"Arabic\",\"Hindi\"],defaultValue:\"en-US\",hidden:({useCustomFormat})=>useCustomFormat},textSelectable:{type:ControlType.Boolean,title:\"Text Select\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DateTimeDisplay\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DateTimeDisplay.map"],"mappings":"0LAMG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,WAAS,OAAO,cAAY,GAAM,eAAa,GAAM,aAAW,KAAK,aAAW,QAAQ,YAAU,UA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