{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/vuEggXV0rmq4QIyvRIxM/ElJTRKiPCQFNIt6EBREj/RelativeDateLabel.js", "ssg:https://framerusercontent.com/modules/d6H5GDxoz29lSipWKW53/ykv4b8IXTOgFkTr9rV4T/klH0ofWY1.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState,useEffect}from\"react\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function RelativeDateLabel(props){const{date,locale,format,transform}=props;const isOptimizing=typeof window===\"undefined\";const[isPast,setIsPast]=useState(true);const[relativeTitle,setRelativeTitle]=useState(\"\");const[isSpecialCase,setIsSpecialCase]=useState(false);useEffect(()=>{if(!date){return;}const compareDate=new Date(date);const now=new Date;// Compare just the dates (year, month, day)\nconst compareYear=compareDate.getUTCFullYear();const compareMonth=compareDate.getUTCMonth();const compareDay=compareDate.getUTCDate();const nowYear=now.getFullYear();const nowMonth=now.getMonth();const nowDay=now.getDate();// Calculate difference based on pure date comparison\n// Calculate the difference in milliseconds and convert to days\nconst compareValue=new Date(Date.UTC(compareYear,compareMonth,compareDay));const nowValue=new Date(Date.UTC(nowYear,nowMonth,nowDay));const diffTime=compareValue.getTime()-nowValue.getTime();const diffDays=Math.floor(diffTime/(1e3*60*60*24));setIsPast(diffDays<0);const formatter=new Intl.RelativeTimeFormat(locale.length>0?locale:undefined,{numeric:format.numeric,style:format.showLabel?format.style:\"narrow\"});const DIVISIONS=[{amount:7,name:\"weeks\"},{amount:4.34524,name:\"months\"},{amount:Number.POSITIVE_INFINITY,name:\"years\"}];function formatTimeAgo(date){// Special handling for today, yesterday, and tomorrow\nif(diffDays===0){setIsSpecialCase(true);return\"Today\";}else if(diffDays===-1){setIsSpecialCase(true);return\"Yesterday\";}else if(diffDays===1){setIsSpecialCase(true);return\"Tomorrow\";}setIsSpecialCase(false);let duration=Math.abs(diffDays);let unit=\"days\";// Convert to larger units automatically\nfor(let i=0;i<DIVISIONS.length;i++){const division=DIVISIONS[i];if(duration<division.amount){break;}duration/=division.amount;unit=division.name;}let result=formatter.format(Math.round(duration),unit).replace(/^in\\s+/,\"\").replace(/\\s+ago$/,\"\");if(!format.showLabel){result=result.replace(/[a-zA-Z]/g,\"\");}if(!format.commas){result=result.replace(/,/g,\"\");}return result;}setRelativeTitle(formatTimeAgo(compareDate));},[date,format,format.commas]);return /*#__PURE__*/_jsx(\"p\",{style:{color:props.fontColor,userSelect:props.textSelect?\"auto\":\"none\",whiteSpace:\"pre\",margin:0,...props.font},children:isOptimizing?null:/*#__PURE__*/_jsxs(_Fragment,{children:[!isSpecialCase&&isPast?transform.pastPrefix:\"\",!isSpecialCase&&!isPast?transform.futurePrefix:\"\",relativeTitle,!isSpecialCase&&isPast?transform.pastSuffix:\"\",!isSpecialCase&&!isPast?transform.futureSuffix:\"\"]})});}RelativeDateLabel.displayName=\"Relative Date Label\";addPropertyControls(RelativeDateLabel,{date:{type:ControlType.Date},locale:{type:ControlType.String,placeholder:`Auto (${typeof navigator!==\"undefined\"?navigator.language:\"\"})`},format:{type:ControlType.Object,buttonTitle:\"Options\",controls:{numeric:{type:ControlType.Enum,defaultValue:\"always\",options:[\"always\",\"auto\"],optionTitles:[\"Always\",\"Auto\"],displaySegmentedControl:true},showLabel:{type:ControlType.Boolean,defaultValue:true},style:{type:ControlType.Enum,defaultValue:\"long\",options:[\"long\",\"short\",\"narrow\"],optionTitles:[\"Long\",\"Short\",\"Narrow\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\",hidden:props=>!props.showLabel},commas:{type:ControlType.Boolean,defaultValue:true}}},transform:{type:ControlType.Object,buttonTitle:\"Prefix & Suffix\",controls:{pastPrefix:{type:ControlType.String,defaultValue:\"\"},pastSuffix:{type:ControlType.String,defaultValue:\" ago\"},futurePrefix:{type:ControlType.String,defaultValue:\"\"},futureSuffix:{type:ControlType.String,defaultValue:\" from now\"}}},fontColor:{type:ControlType.Color,defaultValue:\"#000\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:16,lineHeight:1}},textSelect:{type:ControlType.Boolean,defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RelativeDateLabel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RelativeDateLabel.map", "// Generated by Framer (ab692b1)\nimport{fontStore}from\"framer\";fontStore.loadFonts([]);export const fonts=[{explicitInter:true,fonts:[]}];export const css=[\".framer-G6tJ6 .framer-styles-preset-d0fdc:not(.rich-text-wrapper), .framer-G6tJ6 .framer-styles-preset-d0fdc.rich-text-wrapper a { --framer-link-current-text-color: var(--token-0c25a560-378d-4d7d-b1b1-49ecf787e599, #42d41d); --framer-link-current-text-decoration: underline; --framer-link-hover-text-color: var(--token-5755106a-816d-47df-adc6-48beecd627d2, #000000); --framer-link-hover-text-decoration: underline; --framer-link-text-color: var(--token-0c25a560-378d-4d7d-b1b1-49ecf787e599, #40d41b); --framer-link-text-decoration: underline; }\"];export const className=\"framer-G6tJ6\";\nexport const __FramerMetadata__ = {\"exports\":{\"fonts\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"css\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"className\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],
  "mappings": "+MAGkB,SAARA,EAAmCC,EAAM,CAAC,GAAK,CAAC,KAAAC,EAAK,OAAAC,EAAO,OAAAC,EAAO,UAAAC,CAAS,EAAEJ,EAAYK,EAAa,OAAOC,EAAS,IAAiB,CAACC,EAAOC,CAAS,EAAEC,EAAS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A,EAAY,QAAQ,aAAa,EAAI,EAAE,MAAM,CAAC,KAAKA,EAAY,KAAK,aAAa,OAAO,QAAQ,CAAC,OAAO,QAAQ,QAAQ,EAAE,aAAa,CAAC,OAAO,QAAQ,QAAQ,EAAE,wBAAwB,GAAK,0BAA0B,WAAW,OAAOvC,GAAO,CAACA,EAAM,SAAS,EAAE,OAAO,CAAC,KAAKuC,EAAY,QAAQ,aAAa,EAAI,CAAC,CAAC,EAAE,UAAU,CAAC,KAAKA,EAAY,OAAO,YAAY,kBAAkB,SAAS,CAAC,WAAW,CAAC,KAAKA,EAAY,OAAO,aAAa,EAAE,EAAE,WAAW,CAAC,KAAKA,EAAY,OAAO,aAAa,MAAM,EAAE,aAAa,CAAC,KAAKA,EAAY,OAAO,aAAa,EAAE,EAAE,aAAa,CAAC,KAAKA,EAAY,OAAO,aAAa,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,KAAKA,EAAY,MAAM,aAAa,MAAM,EAAE,KAAK,CAAC,KAAK,OAAO,SAAS,WAAW,gBAAgB,aAAa,aAAa,CAAC,SAAS,GAAG,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,KAAKA,EAAY,QAAQ,aAAa,EAAI,CAAC,CAAC,ECPhlEE,EAAU,UAAU,CAAC,CAAC,EAAS,IAAMC,EAAM,CAAC,CAAC,cAAc,GAAK,MAAM,CAAC,CAAC,CAAC,EAAeC,EAAI,CAAC,kiBAAkiB,EAAeC,EAAU",
  "names": ["RelativeDateLabel", "props", "date", "locale", "format", "transform", "isOptimizing", "window", "isPast", "setIsPast", "ye", "relativeTitle", "setRelativeTitle", "isSpecialCase", "setIsSpecialCase", "ue", "compareDate", "now", "compareYear", "compareMonth", "compareDay", "nowYear", "nowMonth", "nowDay", "compareValue", "nowValue", "diffTime", "diffDays", "formatter", "DIVISIONS", "formatTimeAgo", "duration", "unit", "i", "division", "result", "p", "u", "l", "addPropertyControls", "ControlType", "navigator", "fontStore", "fonts", "css", "className"]
}
