dsg
INSERT INTO `cp_filejs` (`id`,`app`,`path`,`modul`,`file_name`,`content`) VALUES ('273','3','u7/collector','auth','js/utils.js--','export function formatPostDate(date) {\r\n const postDate = new Date(date)\r\n // show date as Just now, 1 minute ago, 1 hour ago, 1 day ago, 1 week ago, 1 month ago, 1 year ago\r\n const currentDate = new Date()\r\n const diff = currentDate - postDate\r\n const seconds = Math.floor(diff / 1000)\r\n const minutes = Math.floor(seconds / 60)\r\n const hours = Math.floor(minutes / 60)\r\n const days = Math.floor(hours / 24)\r\n const weeks = Math.floor(days / 7)\r\n const months = Math.floor(days / 30)\r\n if (months > 0) {\r\n return months === 1 ? \\\\\\\\\\\\\\\'1 month ago\\\\\\\\\\\\\\\' : `${months} months ago`\r\n }\r\n if (weeks > 0) {\r\n return weeks === 1 ? \\\\\\\\\\\\\\\'1 week ago\\\\\\\\\\\\\\\' : `${weeks} weeks ago`\r\n }\r\n if (days > 0) {\r\n return days === 1 ? \\\\\\\\\\\\\\\'1 day ago\\\\\\\\\\\\\\\' : `${days} days ago`\r\n }\r\n if (hours > 0) {\r\n return hours === 1 ? \\\\\\\\\\\\\\\'1 hour ago\\\\\\\\\\\\\\\' : `${hours} hours ago`\r\n }\r\n if (minutes > 0) {\r\n return minutes === 1 ? \\\\\\\\\\\\\\\'1 minute ago\\\\\\\\\\\\\\\' : `${minutes} minutes ago`\r\n }\r\n return \\\\\\\\\\\\\\\'Just now\\\\\\\\\\\\\\\'\r\n}\r\nexport const timedFetch = async (url, fetchObj, error = \\\\\\\\\\\\\\\'Your connection seems unstable.\\\\\\\\\\\\\\\', timeout = TIMEOUT_MS_LOW) => {\r\n const controller = new AbortController()\r\n const signal = controller.signal\r\n try {\r\n const user = await getSessionUser()\r\n if (!user) return\r\n setTimeout(() => {\r\n controller.abort()\r\n }, TIMEOUT_MS_LOW)\r\n const response = await fetch(url,\r\n fetchObj,\r\n signal\r\n )\r\n const data = await response.json()\r\n return data\r\n } catch (error) {\r\n if (error.name === \\\\\\\\\\\\\\\'AbortError\\\\\\\\\\\\\\\') {\r\n throw {\r\n message: error,\r\n name: \\\\\\\"TimeOutError\\\\\\\"\r\n };\r\n } else {\r\n throw error; // Rethrow any other errors\r\n }\r\n }\r\n}');
Copy This

Warning: file_get_contents(/home/u340524018/domains/agniaga.com/public_html/sub/u7/collector/js/utils.js--): Failed to open stream: No such file or directory in /home/u340524018/domains/agniaga.com/public_html/sub/u2/cp/inc.filejs.php on line 190
export function formatPostDate(date) {
  const postDate = new Date(date)
  // show date as Just now, 1 minute ago, 1 hour ago, 1 day ago, 1 week ago, 1 month ago, 1 year ago
  const currentDate = new Date()
  const diff = currentDate - postDate
  const seconds = Math.floor(diff / 1000)
  const minutes = Math.floor(seconds / 60)
  const hours = Math.floor(minutes / 60)
  const days = Math.floor(hours / 24)
  const weeks = Math.floor(days / 7)
  const months = Math.floor(days / 30)
  if (months > 0) {
    return months === 1 ? \\\\\\\'1 month ago\\\\\\\' : `${months} months ago`
  }
  if (weeks > 0) {
    return weeks === 1 ? \\\\\\\'1 week ago\\\\\\\' : `${weeks} weeks ago`
  }
  if (days > 0) {
    return days === 1 ? \\\\\\\'1 day ago\\\\\\\' : `${days} days ago`
  }
  if (hours > 0) {
    return hours === 1 ? \\\\\\\'1 hour ago\\\\\\\' : `${hours} hours ago`
  }
  if (minutes > 0) {
    return minutes === 1 ? \\\\\\\'1 minute ago\\\\\\\' : `${minutes} minutes ago`
  }
  return \\\\\\\'Just now\\\\\\\'
}
export const timedFetch = async (url, fetchObj, error = \\\\\\\'Your connection seems unstable.\\\\\\\', timeout = TIMEOUT_MS_LOW) => {
  const controller = new AbortController()
  const signal = controller.signal
  try {
    const user = await getSessionUser()
    if (!user) return
    setTimeout(() => {
      controller.abort()
    }, TIMEOUT_MS_LOW)
    const response = await fetch(url,
      fetchObj,
      signal
    )
    const data = await response.json()
    return data
  } catch (error) {
    if (error.name === \\\\\\\'AbortError\\\\\\\') {
      throw {
        message: error,
        name: \\\"TimeOutError\\\"
      };
    } else {
      throw error; // Rethrow any other errors
    }
  }
}
Add JS Function Name