{"version":3,"file":"TimeRange.D3PMFpxL.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/c9GvhGXxbXg0eCw2Enc1/vPi54K39bM9mXginEnrO/TimeRange.js"],"sourcesContent":["// Display time range in user's location with customizable format and styling\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TimeRange(props){const{gmtTimezone=\"GMT+8\",startHour=9,endHour=17,format24Hour=false,showTimezone=true,showDate=false,textColor=\"#000000\",backgroundColor,font,separator=\"–\",padding=\"12px 16px\"}=props;const[timeRange,setTimeRange]=useState(\"\");useEffect(()=>{if(typeof window===\"undefined\")return;const updateTime=()=>{const now=new Date;// Parse GMT timezone string (e.g., \"GMT+8\" or \"GMT-5\")\nconst gmtMatch=gmtTimezone.match(/GMT([+-]?\\d+(?:\\.\\d+)?)/);const gmtOffset=gmtMatch?parseFloat(gmtMatch[1]):0;// Create dates in the specified GMT timezone\n// Get current UTC time\nconst utcTime=new Date(now.getTime()+now.getTimezoneOffset()*6e4);// Add the GMT offset to get the time in the specified timezone\nconst gmtTime=new Date(utcTime.getTime()+gmtOffset*36e5);// Create start and end times in GMT timezone\nconst start=new Date(gmtTime);start.setHours(startHour,0,0,0);const end=new Date(gmtTime);end.setHours(endHour,0,0,0);// Convert back to user's local timezone for display\nconst userTimezoneOffset=now.getTimezoneOffset();const startLocal=new Date(start.getTime()-gmtOffset*36e5-userTimezoneOffset*6e4);const endLocal=new Date(end.getTime()-gmtOffset*36e5-userTimezoneOffset*6e4);const options={hour:\"numeric\",minute:\"2-digit\",hour12:!format24Hour};if(showTimezone){options.timeZoneName=\"short\";}// Format start time (no timezone)\nconst startTimeFormatted=startLocal.toLocaleTimeString(undefined,{hour:\"numeric\",minute:\"2-digit\",hour12:!format24Hour}).replace(/\\s+/g,\"\");// Format end time with timezone if needed\nlet endTimeFormatted=endLocal.toLocaleTimeString(undefined,options);// Process end time to separate time from timezone\nlet timePart=endTimeFormatted;let timezonePart=\"\";if(showTimezone){// Split on the last space to separate time from timezone\nconst lastSpaceIndex=endTimeFormatted.lastIndexOf(\" \");if(lastSpaceIndex!==-1){timePart=endTimeFormatted.substring(0,lastSpaceIndex);timezonePart=endTimeFormatted.substring(lastSpaceIndex+1);}}// Remove spaces from time part\ntimePart=timePart.replace(/\\s+/g,\"\");// Combine everything\nlet result=`${startTimeFormatted}${separator}${timePart}`;if(showTimezone&&timezonePart){result+=` ${timezonePart}`;}if(showDate){const dateOptions={weekday:\"short\",month:\"short\",day:\"numeric\"};const dateStr=now.toLocaleDateString(undefined,dateOptions);result=`${dateStr}, ${result}`;}startTransition(()=>setTimeRange(result));};updateTime();const interval=setInterval(updateTime,6e4);return()=>clearInterval(interval);},[startHour,endHour,format24Hour,showTimezone,showDate,separator,gmtTimezone]);const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",...isFixedWidth?{}:{width:\"max-content\"},...backgroundColor&&{backgroundColor},color:textColor,padding,borderRadius:8,...font},children:timeRange||\"Loading...\"});}addPropertyControls(TimeRange,{gmtTimezone:{type:ControlType.String,title:\"GMT Timezone\",defaultValue:\"GMT+8\",placeholder:\"e.g., GMT+8 or GMT-5\"},startHour:{type:ControlType.Number,title:\"Start Hour\",defaultValue:9,min:0,max:23,step:1,displayStepper:true},endHour:{type:ControlType.Number,title:\"End Hour\",defaultValue:17,min:0,max:23,step:1,displayStepper:true},format24Hour:{type:ControlType.Boolean,title:\"Format\",defaultValue:false,enabledTitle:\"24h\",disabledTitle:\"12h\"},showTimezone:{type:ControlType.Boolean,title:\"Timezone\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},showDate:{type:ControlType.Boolean,title:\"Date\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},separator:{type:ControlType.String,title:\"Separator\",defaultValue:\"–\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\",optional:true},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"12px 16px\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TimeRange\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TimeRange.map"],"mappings":"iMAIG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,cAAY,QAAQ,YAAU,EAAE,UAAQ,GAAG,eAAa,GAAM,eAAa,GAAK,WAAS,GAAM,YAAU,UAAU,kBAAgB,OAAK,YAAU,IAAI,UAAQ,aAAa,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAE,EAAE,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAe,CAAC,IAAM,EAAI,IAAI,KACjW,EAAS,EAAY,MAAM,yBAAyB,EAAQ,EAAU,EAAS,WAAW,EAAS,EAAE,EAAE,EAEvG,EAAQ,IAAI,KAAK,EAAI,QAAQ,EAAE,EAAI,kBAAkB,EAAE,GAAG,EAC1D,EAAQ,IAAI,KAAK,EAAQ,QAAQ,EAAE,EAAU,IAAI,EACjD,EAAM,IAAI,KAAK,CAAO,EAAE,EAAM,SAAS,EAAU,EAAE,EAAE,CAAC,EAAE,IAAM,EAAI,IAAI,KAAK,CAAO,EAAE,EAAI,SAAS,EAAQ,EAAE,EAAE,CAAC,EACpH,IAAM,EAAmB,EAAI,kBAAkB,EAAQ,EAAW,IAAI,KAAK,EAAM,Q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