{"version":3,"file":"Time_Date.CNFUtfVc.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/OLHHOyCTh1YifZYY6ach/k4S7DCn0sAEneKIfbKpb/Time_Date.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{localeOptions,containerStyles,fontStack}from\"https://framer.com/m/framer/default-utils.js@^0.45.0\";const SEVEN_DAYS_IN_MS=7*24*60*60*1e3// 7 days in milliseconds\n;const FIXED_START_DATE=new Date(\"2024-10-03\")// Fixed starting point: October 3, 2024\n;/**\n * TIME\n *\n * @framerIntrinsicWidth 140\n * @framerIntrinsicHeight 20\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export function Time(props){const{outputType,fontFamily,fontSize,fontWeight,localeType,customLocale,timeFormat,showYear,showWeekday,showHours,showMinutes,showSeconds,monthFormat,color,font,alignment}=props;// Function to calculate the current displayed date based on fixed start date\nconst calculateCurrentDate=()=>{const now=new Date;const timeSinceStart=now-FIXED_START_DATE;const numberOfWeeks=Math.floor(timeSinceStart/SEVEN_DAYS_IN_MS);const currentDate=new Date(FIXED_START_DATE.getTime()+numberOfWeeks*SEVEN_DAYS_IN_MS);return currentDate;};const[currentDate,setCurrentDate]=React.useState(calculateCurrentDate);// Function to format the date based on user settings\nconst formatDate=date=>{const locale=localeType===\"custom\"?[customLocale]:[];let formatOptions={weekday:showWeekday?\"long\":undefined,day:\"numeric\",month:monthFormat,year:showYear?\"numeric\":undefined};return new Intl.DateTimeFormat(locale,formatOptions).format(date);};// Update the current date when the component mounts\nReact.useEffect(()=>{const interval=setInterval(()=>{setCurrentDate(calculateCurrentDate);},SEVEN_DAYS_IN_MS)// Check every 7 days\n;return()=>clearInterval(interval);},[]);return /*#__PURE__*/_jsx(\"div\",{style:{...containerStyles,color,fontFamily:fontStack,fontWeight:500,fontSize:16,...font},children:/*#__PURE__*/_jsx(\"span\",{style:{width:\"100%\"},children:formatDate(currentDate)})});}Time.defaultProps={height:20,width:140,outputType:\"date\",localeType:\"auto\",customLocale:\"en-US\",color:\"#999\",timeFormat:\"24h\",showYear:true,showWeekday:true,showHours:true,showMinutes:true,showSeconds:false,monthFormat:\"long\",alignment:\"center\"};Time.displayName=\"Time & Date\";addPropertyControls(Time,{outputType:{title:\"Type\",type:ControlType.Enum,displaySegmentedControl:true,options:[\"date\",\"time\"],optionTitles:[\"Date\",\"Time\"],defaultValue:Time.defaultProps.outputType},showWeekday:{title:\"Weekday\",type:ControlType.Boolean,enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:Time.defaultProps.showWeekday,hidden:props=>props.outputType!==\"date\"},monthFormat:{title:\"Month\",type:ControlType.Enum,options:[\"short\",\"long\",\"numeric\"],optionTitles:[\"Short\",\"Long\",\"Numeric\"],defaultValue:Time.defaultProps.monthFormat,hidden:props=>props.outputType!==\"date\"},showYear:{title:\"Year\",type:ControlType.Boolean,enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:Time.defaultProps.showYear,hidden:props=>props.outputType!==\"date\"},timeFormat:{title:\"Format\",type:ControlType.Enum,options:[\"12h\",\"24h\"],optionTitles:[\"12h\",\"24h\"],displaySegmentedControl:true,defaultValue:Time.defaultProps.timeFormat,hidden:props=>props.outputType!==\"time\"},showHours:{title:\"Hours\",type:ControlType.Boolean,enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:Time.defaultProps.showHours,hidden:props=>props.outputType!==\"time\"},showMinutes:{title:\"Minutes\",type:ControlType.Boolean,enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:Time.defaultProps.showMinutes,hidden:props=>props.outputType!==\"time\"},showSeconds:{title:\"Seconds\",type:ControlType.Boolean,enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:Time.defaultProps.showSeconds,hidden:props=>props.outputType!==\"time\"||!props.showMinutes},localeType:{title:\"Locale\",type:ControlType.Enum,displaySegmentedControl:true,options:[\"custom\",\"auto\"],optionTitles:[\"Custom\",\"Auto\"],defaultValue:Time.defaultProps.localeType},customLocale:{title:\" \",type:ControlType.Enum,options:Object.keys(localeOptions).sort(),optionTitles:Object.keys(localeOptions).sort().map(key=>localeOptions[key]),hidden:props=>props.localeType!==\"custom\",defaultValue:\"en\"},font:{// @ts-expect-error – Internal\ntype:ControlType.Font,controls:\"extended\"},color:{type:ControlType.Color,defaultValue:Time.defaultProps.color}});\nexport const __FramerMetadata__ = {\"exports\":{\"Time\":{\"type\":\"reactComponent\",\"name\":\"Time\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerIntrinsicHeight\":\"20\",\"framerIntrinsicWidth\":\"140\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Time_Date.map"],"mappings":"scAUG,SAAgB,EAAK,EAAM,CAAC,GAAK,CAAC,aAAW,aAAW,WAAS,aAAW,aAAW,eAAa,aAAW,WAAS,cAAY,YAAU,cAAY,cAAY,cAAY,QAAM,OAAK,aAAW,EACrM,MAAyB,CAAoB,IAAM,EAAf,IAAI,KAA8B,EAAuB,EAAc,KAAK,MAAM,EAAe,EAAiB,CAAuF,OAApE,IAAI,KAAK,EAAiB,SAAS,CAAC,EAAc,EAAiB,EAA2B,CAAC,EAAY,GAAgBA,EAAe,EAAqB,CACxU,EAAW,GAAM,CAAC,IAAM,EAAO,IAAa,SAAS,CAAC,EAAa,CAAC,EAAE,CAAK,EAAc,CAAC,QAAQ,EAAY,OAAO,IAAA,GAAU,IAAI,UAAU,MAAM,EAAY,KAAK,EAAS,UAAU,IAAA,GAAU,CAAC,OAAO,IAAI,KAAK,eAAe,EAAO,EAAc,CAAC,OAAO,EAAK,EAEhO,OADzC,MAAoB,CAAC,IAAM,EAAS,gBAAgB,CAAC,EAAe,EAAqB,EAAG,EAAiB,CAC5G,UAAU,cAAc,EAAS,EAAG,EAAE,CAAC,CAAqB,EAAK,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