{"id":1439,"date":"2026-06-27T14:03:21","date_gmt":"2026-06-27T13:03:21","guid":{"rendered":"https:\/\/sober.ie\/?page_id=1439"},"modified":"2026-06-27T14:36:42","modified_gmt":"2026-06-27T13:36:42","slug":"how-long-am-i-sober","status":"publish","type":"page","link":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/","title":{"rendered":"How Long Am I Sober?"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1439\" class=\"elementor elementor-1439\">\n\t\t\t\t<div class=\"elementor-element elementor-element-b128a90 e-flex e-con-boxed e-con e-parent\" data-id=\"b128a90\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-724a843 elementor-widget elementor-widget-html\" data-id=\"724a843\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!-- Load HTML2Canvas securely to enable image downloads -->\n<script src=\"https:\/\/cloudflare.com\"><\/script>\n\n<div class=\"sober-calc-container\" style=\"max-width: 400px; margin: 20px auto; padding: 25px; border-radius: 12px; background: #ffffff; box-shadow: 0 4px 20px rgba(0,0,0,0.08); font-family: sans-serif; text-align: center; border: 1px solid #e2e8f0; box-sizing: border-box;\">\n  <h3 style=\"margin-top: 0; color: #1a202c; font-size: 1.4rem; font-weight: 700;\">Sober Calculator<\/h3>\n  \n  <div id=\"wp-setup-stage\">\n    <p style=\"margin: 0 0 15px 0; color: #64748b; font-size: 0.9rem;\">Enter your exact recovery start date and time:<\/p>\n    \n    <div style=\"display: flex; gap: 10px; margin-bottom: 15px; text-align: left;\">\n      <div style=\"flex: 1;\">\n        <label for=\"wp-sober-date\" style=\"display: block; margin-bottom: 5px; color: #4a5568; font-size: 0.8rem; font-weight: 600;\">Date:<\/label>\n        <input type=\"date\" id=\"wp-sober-date\" style=\"width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; box-sizing: border-box; font-size: 0.95rem;\">\n      <\/div>\n      <div style=\"flex: 1;\">\n        <label for=\"wp-sober-time\" style=\"display: block; margin-bottom: 5px; color: #4a5568; font-size: 0.8rem; font-weight: 600;\">Exact Time:<\/label>\n        <input type=\"time\" id=\"wp-sober-time\" value=\"00:00\" style=\"width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; box-sizing: border-box; font-size: 0.95rem;\">\n      <\/div>\n    <\/div>\n    \n    <button onclick=\"saveAndCalculateSoberTime()\" style=\"width: 100%; background: #ea8914; color: white; border: none; padding: 12px; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: bold; transition: background 0.2s;\">Track My Journey<\/button>\n  <\/div>\n  \n  <!-- This entire wrapper box is what gets converted and downloaded as a badge graphic -->\n  <div id=\"wp-sober-results\" style=\"margin-top: 15px; display: none; padding: 20px; border-radius: 10px; background: #f8fafc; border: 1px solid #f1f5f9; position: relative;\">\n    \n    <!-- Dynamically Rendered SVG Token Coin Component -->\n    <div id=\"coin-graphic-container\" style=\"margin-bottom: 15px; height: 110px; display: flex; justify-content: center; align-items: center;\"><\/div>\n    \n    <p style=\"margin: 0 0 5px 0; color: #64748b; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 600;\">Current Milestone<\/p>\n    <div id=\"wp-sober-counter\" style=\"font-weight: bold; color: #ea8914; line-height: 1.5; margin-bottom: 15px;\"><\/div>\n    \n    <button onclick=\"downloadSoberBadge()\" style=\"width: 100%; background: #ea8914; color: white; border: none; padding: 10px; border-radius: 6px; cursor: pointer; font-size: 0.9rem; font-weight: bold; margin-bottom: 10px; transition: background 0.2s;\">\ud83d\udcbe Download Shareable Badge<\/button>\n    <br>\n    <button onclick=\"clearSoberDate()\" style=\"background: none; border: none; color: #ef4444; font-size: 0.8rem; cursor: pointer; text-decoration: underline; padding: 5px;\">Reset Date<\/button>\n  <\/div>\n<\/div>\n\n<script>\nlet wpSoberInterval;\n\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n  const savedDateTime = localStorage.getItem('userSobrietyDateTime');\n  if (savedDateTime) {\n    const splitCheck = savedDateTime.split('T');\n    document.getElementById('wp-sober-date').value = splitCheck[0];\n    document.getElementById('wp-sober-time').value = splitCheck[1];\n    runSoberClock(savedDateTime);\n  }\n});\n\nfunction saveAndCalculateSoberTime() {\n  const inputDate = document.getElementById('wp-sober-date').value;\n  const inputTime = document.getElementById('wp-sober-time').value || \"00:00\";\n  \n  if (!inputDate) return;\n  const combinedDateTimeString = `${inputDate}T${inputTime}`;\n  \n  localStorage.setItem('userSobrietyDateTime', combinedDateTimeString);\n  runSoberClock(combinedDateTimeString);\n}\n\nfunction runSoberClock(dateTimeString) {\n  clearInterval(wpSoberInterval);\n  document.getElementById('wp-setup-stage').style.display = 'none';\n  \n  const updateWidget = () => {\n    const now = new Date();\n    const startDate = new Date(dateTimeString);\n\n    if (now - startDate < 0) {\n      document.getElementById('wp-sober-counter').innerHTML = \"Date cannot be in the future.\";\n      document.getElementById('wp-sober-results').style.display = 'block';\n      return;\n    }\n\n    let years = now.getFullYear() - startDate.getFullYear();\n    let months = now.getMonth() - startDate.getMonth();\n    \n    let msDiff = now - startDate;\n    let seconds = Math.floor(msDiff \/ 1000) % 60;\n    let minutes = Math.floor(msDiff \/ (1000 * 60)) % 60;\n    let hours = Math.floor(msDiff \/ (1000 * 60 * 60)) % 24;\n    \n    let days = now.getDate() - startDate.getDate();\n\n    if (days < 0) {\n      months--;\n      const previousMonth = new Date(now.getFullYear(), now.getMonth(), 0);\n      days += previousMonth.getDate();\n    }\n    if (months < 0) {\n      years--;\n      months += 12;\n    }\n    \n    const currentDayTimeStr = now.toTimeString().split(' ')[0].substring(0,5);\n    const targetDayTimeStr = dateTimeString.split('T')[1];\n    if (currentDayTimeStr < targetDayTimeStr && days > 0) {\n       days--;\n    }\n\n    let trackingOutput = `<span style=\"font-size: 1.6rem; display:block; margin-bottom: 5px; color:#0f172a;\">`;\n    if (years > 0) trackingOutput += `${years}y `;\n    if (months > 0 || years > 0) trackingOutput += `${months}m `;\n    trackingOutput += `${days}d<\/span>`;\n    trackingOutput += `<span style=\"color:#64748b; font-size:1rem; font-family:monospace;\">${hours.toString().padStart(2, '0')}h : ${minutes.toString().padStart(2, '0')}m : ${seconds.toString().padStart(2, '0')}s<\/span>`;\n\n    document.getElementById('wp-sober-results').style.display = 'block';\n    document.getElementById('wp-sober-counter').innerHTML = trackingOutput;\n\n    renderCoin(years, months, days);\n  };\n\n  updateWidget();\n  wpSoberInterval = setInterval(updateWidget, 1000);\n}\n\nfunction renderCoin(years, months, days) {\n  let coinColor = \"#94a3b8\"; \n  let textLabel = \"24 HRS\";\n  \n  if (years >= 1) {\n    coinColor = \"#fbbf24\"; \n    textLabel = `${years} ${years === 1 ? 'YEAR' : 'YEARS'}`;\n  } else if (months >= 9) {\n    coinColor = \"#22c55e\"; \n    textLabel = \"9 MONTHS\";\n  } else if (months >= 6) {\n    coinColor = \"#3b82f6\"; \n    textLabel = \"6 MONTHS\";\n  } else if (months >= 3) {\n    coinColor = \"#a855f7\"; \n    textLabel = \"3 MONTHS\";\n  } else if (months >= 1) {\n    coinColor = \"#f97316\"; \n    textLabel = \"1 MONTH\";\n  } else if (days >= 1) {\n    coinColor = \"#cbd5e1\"; \n    textLabel = \"ALIVE\";\n  }\n\n  document.getElementById('coin-graphic-container').innerHTML = `\n    <svg width=\"100\" height=\"100\" viewBox=\"0 0 100 100\" style=\"filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.15));\">\n      <circle cx=\"50\" cy=\"50\" r=\"46\" fill=\"${coinColor}\" stroke=\"#ffffff\" stroke-width=\"2\"\/>\n      <circle cx=\"50\" cy=\"50\" r=\"41\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"1\" stroke-dasharray=\"3,3\"\/>\n      <polygon points=\"50,16 78,72 22,72\" fill=\"none\" stroke=\"#ffffff\" stroke-width=\"2\" stroke-linejoin=\"round\"\/>\n      <text x=\"50\" y=\"86\" font-family=\"sans-serif\" font-size=\"7\" font-weight=\"bold\" fill=\"#ffffff\" text-anchor=\"middle\">ONE DAY AT A TIME<\/text>\n      <text x=\"50\" y=\"58\" font-family=\"sans-serif\" font-size=\"8\" font-weight=\"900\" fill=\"#ffffff\" text-anchor=\"middle\">${textLabel}<\/text>\n    <\/svg>\n  `;\n}\n\nfunction downloadSoberBadge() {\n  const targetCard = document.getElementById('wp-sober-results');\n  html2canvas(targetCard, { scale: 2, useCORS: true }).then(canvas => {\n    const imgData = canvas.toDataURL('image\/png');\n    const systemLink = document.createElement('a');\n    systemLink.download = 'my-sobriety-milestone.png';\n    systemLink.href = imgData;\n    systemLink.click();\n  });\n}\n\nfunction clearSoberDate() {\n  clearInterval(wpSoberInterval);\n  localStorage.removeItem('userSobrietyDateTime');\n  document.getElementById('wp-sober-date').value = '';\n  document.getElementById('wp-sober-time').value = '00:00';\n  document.getElementById('wp-sober-results').style.display = 'none';\n  document.getElementById('wp-setup-stage').style.display = 'block';\n}\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Sober Calculator Enter your exact recovery start date and time: Date: Exact Time: Track My Journey Current Milestone \ud83d\udcbe Download Shareable Badge Reset Date<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page-sidebar.php","meta":{"footnotes":""},"class_list":["post-1439","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How Long Am I Sober? - Sober.ie V1.5<\/title>\n<meta name=\"description\" content=\"Interested in knowing how long your sober? In my opinion even as a one day at a time program, milestones should be celebrated!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How Long Am I Sober? - Sober.ie V1.5\" \/>\n<meta property=\"og:description\" content=\"Interested in knowing how long your sober? In my opinion even as a one day at a time program, milestones should be celebrated!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/\" \/>\n<meta property=\"og:site_name\" content=\"Sober.ie V1.5\" \/>\n<meta property=\"article:modified_time\" content=\"2026-06-27T13:36:42+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sober.ie\\\/index.php\\\/how-long-am-i-sober\\\/\",\"url\":\"https:\\\/\\\/sober.ie\\\/index.php\\\/how-long-am-i-sober\\\/\",\"name\":\"How Long Am I Sober? - Sober.ie V1.5\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sober.ie\\\/#website\"},\"datePublished\":\"2026-06-27T13:03:21+00:00\",\"dateModified\":\"2026-06-27T13:36:42+00:00\",\"description\":\"Interested in knowing how long your sober? In my opinion even as a one day at a time program, milestones should be celebrated!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sober.ie\\\/index.php\\\/how-long-am-i-sober\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sober.ie\\\/index.php\\\/how-long-am-i-sober\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sober.ie\\\/index.php\\\/how-long-am-i-sober\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sober.ie\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Long Am I Sober?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sober.ie\\\/#website\",\"url\":\"https:\\\/\\\/sober.ie\\\/\",\"name\":\"Sober.ie V1.0\",\"description\":\"Happy Living\",\"publisher\":{\"@id\":\"https:\\\/\\\/sober.ie\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sober.ie\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/sober.ie\\\/#organization\",\"name\":\"Sober.ie\",\"url\":\"https:\\\/\\\/sober.ie\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sober.ie\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/sober.ie\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/SoberLogo.png\",\"contentUrl\":\"https:\\\/\\\/sober.ie\\\/wp-content\\\/uploads\\\/2025\\\/03\\\/SoberLogo.png\",\"width\":300,\"height\":100,\"caption\":\"Sober.ie\"},\"image\":{\"@id\":\"https:\\\/\\\/sober.ie\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How Long Am I Sober? - Sober.ie V1.5","description":"Interested in knowing how long your sober? In my opinion even as a one day at a time program, milestones should be celebrated!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/","og_locale":"en_US","og_type":"article","og_title":"How Long Am I Sober? - Sober.ie V1.5","og_description":"Interested in knowing how long your sober? In my opinion even as a one day at a time program, milestones should be celebrated!","og_url":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/","og_site_name":"Sober.ie V1.5","article_modified_time":"2026-06-27T13:36:42+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/","url":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/","name":"How Long Am I Sober? - Sober.ie V1.5","isPartOf":{"@id":"https:\/\/sober.ie\/#website"},"datePublished":"2026-06-27T13:03:21+00:00","dateModified":"2026-06-27T13:36:42+00:00","description":"Interested in knowing how long your sober? In my opinion even as a one day at a time program, milestones should be celebrated!","breadcrumb":{"@id":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/sober.ie\/index.php\/how-long-am-i-sober\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sober.ie\/"},{"@type":"ListItem","position":2,"name":"How Long Am I Sober?"}]},{"@type":"WebSite","@id":"https:\/\/sober.ie\/#website","url":"https:\/\/sober.ie\/","name":"Sober.ie V1.0","description":"Happy Living","publisher":{"@id":"https:\/\/sober.ie\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sober.ie\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/sober.ie\/#organization","name":"Sober.ie","url":"https:\/\/sober.ie\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sober.ie\/#\/schema\/logo\/image\/","url":"https:\/\/sober.ie\/wp-content\/uploads\/2025\/03\/SoberLogo.png","contentUrl":"https:\/\/sober.ie\/wp-content\/uploads\/2025\/03\/SoberLogo.png","width":300,"height":100,"caption":"Sober.ie"},"image":{"@id":"https:\/\/sober.ie\/#\/schema\/logo\/image\/"}}]}},"featured_image":false,"_links":{"self":[{"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/pages\/1439","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/comments?post=1439"}],"version-history":[{"count":10,"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/pages\/1439\/revisions"}],"predecessor-version":[{"id":1452,"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/pages\/1439\/revisions\/1452"}],"wp:attachment":[{"href":"https:\/\/sober.ie\/index.php\/wp-json\/wp\/v2\/media?parent=1439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}