{"id":67,"date":"2024-01-23T19:41:55","date_gmt":"2024-01-23T19:41:55","guid":{"rendered":"https:\/\/sadpoetryhub.com\/?page_id=67"},"modified":"2024-01-23T19:41:55","modified_gmt":"2024-01-23T19:41:55","slug":"pregnancy-calculator","status":"publish","type":"page","link":"https:\/\/sadpoetryhub.com\/?page_id=67","title":{"rendered":"PREGNANCY CALCULATOR"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Pregnancy Calculator<\/title>\n    <style>\n        body {\n            font-family: 'Arial', sans-serif;\n            background-color: #f4f4f4;\n            margin: 0;\n            padding: 0;\n            display: flex;\n            flex-direction: column; \/* Align children vertically *\/\n            align-items: center;\n            justify-content: center;\n            min-height: 100vh;\n        }\n\n        header {\n            text-align: left; \/* Align header content to the left *\/\n            width: 100%; \/* Take full width *\/\n            padding: 10px; \/* Add padding for better appearance *\/\n            box-sizing: border-box; \/* Include padding in width calculation *\/\n        }\n\n        .calculator-container {\n            background-color: #fff;\n            padding: 20px;\n            border-radius: 8px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n            text-align: center;\n            width: 90%;\n            max-width: 900px;\n            margin-top: 20px; \/* Add space between header and calculator *\/\n        }\n\n        h1 {\n            color: #333;\n            margin: 0; \/* Remove default margin *\/\n        }\n\n        label {\n            display: block;\n            margin-top: 10px;\n        }\n\n        input, select {\n            width: 100%;\n            padding: 8px;\n            margin-top: 5px;\n            margin-bottom: 15px;\n            box-sizing: border-box;\n        }\n\n        button {\n            background-color: #4caf50;\n            color: #fff;\n            padding: 10px;\n            border: none;\n            border-radius: 4px;\n            cursor: pointer;\n        }\n\n        button:hover {\n            background-color: #45a049;\n        }\n\n        #result {\n            margin-top: 20px;\n            font-weight: bold;\n        }\n\n        \/* Responsive Styling *\/\n        @media screen and (max-width: 600px) {\n            .calculator-container {\n                width: 100%;\n            }\n        }\n    <\/style>\n<\/head>\n<body>\n    <header>\n        <h1>Pregnancy Calculator<\/h1>\n    <\/header>\n\n    <div class=\"calculator-container\">\n        <label for=\"calculationType\">Choose Calculation Type:<\/label>\n        <select id=\"calculationType\">\n            <option value=\"lastPeriod\">Last Menstrual Period<\/option>\n            <option value=\"conceptionDate\">Conception Date<\/option>\n            <option value=\"dueDate\">Due Date<\/option>\n            <option value=\"cycleLength\">Average Length of Cycles<\/option>\n        <\/select>\n\n        <div id=\"dateInputSection\">\n            <label for=\"dateInput\">Enter Date:<\/label>\n            <input type=\"date\" id=\"dateInput\" required>\n        <\/div>\n\n        <div id=\"cycleLengthSection\" style=\"display:none;\">\n            <label for=\"cycleLengthInput\">Enter Average Length of Cycles (in days):<\/label>\n            <input type=\"number\" id=\"cycleLengthInput\">\n        <\/div>\n\n        <button onclick=\"calculateDueDate()\">Calculate<\/button>\n\n        <div id=\"result\"><\/div>\n    <\/div>\n\n    <script>\n        function calculateDueDate() {\n            var calculationType = document.getElementById('calculationType').value;\n            var dateInput = document.getElementById('dateInput').value;\n            var cycleLengthInput = document.getElementById('cycleLengthInput').value;\n\n            if (calculationType === 'cycleLength' && !cycleLengthInput) {\n                alert(\"Please enter a valid cycle length.\");\n                return;\n            }\n\n            if (!dateInput) {\n                alert(\"Please enter a valid date.\");\n                return;\n            }\n\n            var estimatedDueDate;\n\n            \/\/ Perform calculations based on the selected calculation type\n            switch (calculationType) {\n                case 'lastPeriod':\n                    estimatedDueDate = calculateDueDateFromLastPeriod(dateInput);\n                    break;\n                case 'conceptionDate':\n                    estimatedDueDate = calculateDueDateFromConceptionDate(dateInput);\n                    break;\n                case 'dueDate':\n                    estimatedDueDate = new Date(dateInput);\n                    break;\n                case 'cycleLength':\n                    estimatedDueDate = calculateDueDateFromCycleLength(cycleLengthInput);\n                    break;\n                default:\n                    alert(\"Invalid calculation type.\");\n                    return;\n            }\n\n            var options = { year: 'numeric', month: 'long', day: 'numeric' };\n            var formattedDueDate = estimatedDueDate.toLocaleDateString('en-US', options);\n\n            document.getElementById('result').innerText = \"Your estimated due date is \" + formattedDueDate + \".\";\n        }\n\n        function calculateDueDateFromLastPeriod(lastPeriod) {\n            var lastPeriodDate = new Date(lastPeriod);\n            var estimatedDueDate = new Date(lastPeriodDate);\n            estimatedDueDate.setDate(lastPeriodDate.getDate() + 280);\n            return estimatedDueDate;\n        }\n\n        function calculateDueDateFromConceptionDate(conceptionDate) {\n            var estimatedDueDate = new Date(conceptionDate);\n            estimatedDueDate.setDate(estimatedDueDate.getDate() + 280);\n            return estimatedDueDate;\n        }\n\n        function calculateDueDateFromCycleLength(cycleLength) {\n            \/\/ Assuming a standard 28-day cycle, you can adjust this logic based on your requirements\n            var currentDate = new Date();\n            var estimatedDueDate = new Date(currentDate);\n            estimatedDueDate.setDate(currentDate.getDate() + parseInt(cycleLength));\n            return estimatedDueDate;\n        }\n\n        \/\/ Toggle display of cycle length input based on the selected option\n        document.getElementById('calculationType').addEventListener('change', function () {\n            var cycleLengthSection = document.getElementById('cycleLengthSection');\n            cycleLengthSection.style.display = (this.value === 'cycleLength') ? 'block' : 'none';\n        });\n    <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Pregnancy Calculator Pregnancy Calculator Choose Calculation Type: Last Menstrual PeriodConception DateDue DateAverage Length of Cycles Enter Date: Enter Average Length [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-67","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=\/wp\/v2\/pages\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67"}],"version-history":[{"count":0,"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=\/wp\/v2\/pages\/67\/revisions"}],"wp:attachment":[{"href":"https:\/\/sadpoetryhub.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}