{"id":7750,"date":"2023-10-04T13:31:29","date_gmt":"2023-10-04T17:31:29","guid":{"rendered":"http:\/\/www.germaniamutual.com\/g\/?page_id=7750"},"modified":"2024-02-08T10:32:33","modified_gmt":"2024-02-08T15:32:33","slug":"seasonalcalculator","status":"publish","type":"page","link":"https:\/\/www.germaniamutual.com\/g\/seasonalcalculator\/","title":{"rendered":""},"content":{"rendered":"\n<!DOCTYPE html>\n<html>\n<head>\n    <title>Premium Cancellation Calculator<\/title>\n    <script>\n        function daysBetween(startDate, endDate) {\n\n            const timeDifference = endDate - startDate;\n            const daysDif = Math.floor(timeDifference \/ (1000 * 3600 * 24));\n            return daysDif;\n        }\n\n        function calculate() {\n            const startDate = document.getElementById('startDate').value;\n            const endDate = document.getElementById('endDate').value;\n            const premium = parseFloat(document.getElementById('premium').value);\n            var checkbox = document.getElementById(\"summerwinter\");\n\n            if (!startDate || !endDate || isNaN(premium)) {\n                alert('Please enter valid input.');\n                return;\n            }\n\n            const date1 = new Date(startDate);\n            const date2 = new Date(endDate);\n\n            const daysDif = daysBetween(date1, date2);\n\n            if (checkbox.checked) { \/\/Winter\n                var percent = calculateMonths(date1,date2,daysDif,0);\n\n\n            } else{ \/\/Summer\n                var percent = calculateMonths(date1,date2,daysDif,1);\n\n            }\n\n            const proRataPercent = (daysDif \/ 365).toFixed(4);\n\n            document.getElementById('daysInForce').textContent = daysDif;\n\n            document.getElementById('percentRetainedProRata').textContent =  (percent*100).toFixed(2) + ' %' ;\n            document.getElementById('amountRetainedProRata').textContent = `${(percent * premium).toFixed(0)}`;\n            document.getElementById('amountRefundProRata').textContent = `${((1 - percent) * premium).toFixed(0)}`;\n        }\n\n        function calculateMonths(startDate,endDate,daysDif,winterOrSummer) {\n            var daysFormula = []\n            if (winterOrSummer == 0){ \/\/ winter rates\n                 daysFormula = [0.25,0.25,0.15,0,0,0,0,0,0,0,0.1,0.25]; \n            } else { \/\/ summer rates\n                 daysFormula = [0,0,0.05,0.1,0.1,0.2,0.2,0.2,0.1,0.05,0,0];\n            }\n\n            if (startDate.getMonth()<endDate.getMonth()){\n                numElementsToTraverse = endDate.getMonth() - startDate.getMonth() \n            } else if (endDate.getMonth() < startDate.getMonth()){\n                numElementsToTraverse = 12 - startDate.getMonth() + endDate.getMonth()\n            } else if (startDate.getMonth() == endDate.getMonth()) {\n                if (startDate.getFullYear() != endDate.getFullYear()) {\n                    numElementsToTraverse = 12\n                }\n            } else {\n                numElementsToTraverse = 1\n            }\n\n            console.log(\"startDate Month \" + startDate.getMonth())\n            console.log(\"endDate Month \" + endDate.getMonth())\n            console.log(\"startDate year \" + startDate.getFullYear())\n            console.log(\"endDate year \" + endDate.getFullYear())\n\n            const lastDayOfMonthStart = new Date(startDate.getFullYear(), startDate.getMonth() + 1, 0);\n            var total = 0;\n\n            console.log(\"num elements \" + numElementsToTraverse)\n            console.log(\" ----- ----- -----\")\n            var count = 0;\n            for (let i = startDate.getMonth(); i <startDate.getMonth() + numElementsToTraverse+1; i++) {\n                count = count +1;\n                const index = i % 12\n                var lastDayOfMonth = new Date(startDate.getFullYear(), index + 1, 0).getDate();\n                console.log('Last Day Of Month --- ' + lastDayOfMonth)\n                console.log('Index --- ' + index)\n                if (startDate.getMonth() == endDate.getMonth()){\n                    if (startDate.getFullYear() == endDate.getFullYear()){\n                        var percentOfMonth = daysDif\/lastDayOfMonth;\n                        total = total+ (percentOfMonth*daysFormula[index])\n                        console.log('Total Start == END --- ' + total)\n                        break;\n                    }\n                }\n\n                if (count == 1){\n                    var percentOfMonth = (lastDayOfMonth-(startDate.getDate()))\/lastDayOfMonth;\n                    console.log('Start Date . GetDate == Start --- ' + startDate.getDate())\n                    console.log('PercentOfMonth Index == Start --- ' + percentOfMonth)\n                    total = total+ (percentOfMonth*daysFormula[index])\n                    console.log('Total Index == Start --- ' + total)\n                } \n\n                if (count == numElementsToTraverse+1){\n                    percentOfMonth = (endDate.getDate())\/lastDayOfMonth\n                    total = total+ (percentOfMonth*daysFormula[index])\n                    console.log('Total Index == END --- ' + total)\n                }\n                \n                if (index!= endDate.getMonth()){\n                    if (i!= startDate.getMonth()){\n                   total = total + daysFormula[index]\n                    console.log('Total Index != END --- ' + total)\n                }}\n\n                console.log(\" ----- ----- -----\")\n            }\n            console.log(\"Total \" + total)\n\n            return total; \/\/ Default value if daysDif is greater than the last value in daysFormula\n        }\n        \n    <\/script>\n\n\n<html>\n<head>\n <link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/4.7.0\/css\/font-awesome.min.css\">\n\n\n    <style>\n        @import url(\"https:\/\/use.fontawesome.com\/releases\/v5.13.0\/css\/all.css\");    \n        \/* Remove underline from links with the class \"no-link\" *\/\n        .no-link {\n            text-decoration: none;\n        }\n\n        .arrow-button {\n            display: flex;\n            color: #6e7073;\n            background-color: #b6e2dc;\n            padding: 10px 16px;\n            border-radius: 20px;\n            transition: all .3s ease;\n            font-weight: bold;\n            cursor: pointer;\n            align-items: center;\n            font-size: 14px;\n        }\n\n        .arrow-button > .arrow {\n            width: 6px;\n            height: 6px;\n            border-right: 2px solid #6e7073;\n            border-bottom: 2px solid #6e7073;\n            position: relative;\n            transform: rotate(-45deg);\n            margin: 0 6px;\n            transition: all .3s ease;\n        }\n\n        .arrow-button > .arrow::before {\n            display: block;\n            background-color: currentColor;\n            width: 3px;\n            transform-origin: bottom right;\n            height: 2px;\n            position: absolute;\n            opacity: 0;\n            bottom: calc(-2px \/ 2);\n            transform: rotate(45deg);\n            transition: all .3s ease;\n            content: \"\";\n            right: 0;\n        }\n\n        .arrow-button:hover > .arrow {\n            transform: rotate(-45deg) translate(4px, 4px);\n            border-color: text-hover-color;\n        }\n\n        .arrow-button:hover > .arrow::before {\n            opacity: 1;\n            width: 8px;\n        }\n\n        .arrow-button:hover {\n            background-color: #54515f;\n            color: #fff;\n        }\n\n        body {\n            font-family: Arial, sans-serif;\n            text-align: center;\n            background-color: #f4f4f4;\n        }\n        \n        h1 {\n            color: #333;\n        }\n\n        .date-label {\n            display: inline-block;\n            vertical-align: top;\n            width: 170px;\n        }\n\n        .date-input input[type=\"date\"] {\n            padding: 5px;\n            border: 1px solid #ccc;\n            border-radius: 3px;\n        }\n\n        .section-container {\n            display: inline-block;\n            text-align: left;\n            vertical-align: top;\n            margin: 10px;\n            width: 160px;\n            border: 1px solid #ccc;\n            border-radius: 5px;\n            padding: 10px;\n            background-color: #fff;\n            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n        }\n\n        .section-container-noborder {\n            display: inline-block;\n            text-align: left;\n            vertical-align: top;\n\n        }\n\n        .section-title {\n            font-size: 1.2em;\n            font-weight: bold;\n            margin-bottom: 10px;\n            text-align: center; \/* Center the section title *\/\n        }\n\n        button {\n            padding: 10px 20px;\n            background-color: #333;\n            color: #fff;\n            border: none;\n            border-radius: 3px;\n            cursor: pointer;\n        }\n\n        .section-content {\n            text-align: center;\n        }\n\n        button:hover {\n            background-color: #555;\n        }\n\n        p {\n            margin: 10px 0;\n            font-weight: bold;\n        }\n\n        span {\n            color: #555;\n        }\n\n        .switch{\n            font-size: 17px;\n            position: relative;\n            display: inline-block;\n            width: 3.5em;\n            height: 1.4em;\n        }\n\n        .switch input {\n            opactiy: 0;\n            width: 0;\n            height: 0;\n        }\n\n        .slider{\n            position: absolute;\n            cursor: pointer;\n            top: 0;\n            left: 0;\n            right: 0;\n            bottom: 0;\n            background-color: #808080;\n            transition: .4s;\n            border-radius: 30px;\n        }\n\n        .slider:before {\n            position: absolute;\n            font-family: \"Font Awesome 5 Free\";\n            content: \"\\f185\";\n            height: 1.4em;\n            width: 1.4em;\n            top: 0.01em;\n            border-radius: 20px;\n            left: 0.3em;\n            background: linear-gradient(40deg,#fcf297,#ffec40 70%);\n            transition: .4s;\n        }\n\n        input:checked + .slider{\n            background-color: #808080;\n        }\n\n        input:checked + .slider:before{\n            transform: translateX(1.5em);\n            content: \"\\f2dc\"; \n\n            background: #FFFFFF;\n            \n        }\n\n        #head {\n            background-color: #333;\n            color: #fff;\n            text-align: center;\n            padding: 10px 0;\n        }\n\n         \/* Style the navigation menu *\/\n        .naver {\n            display: flex;\n            justify-content: center;\n        }\n\n        .naver-list {\n            list-style-type: none;\n            display: flex;\n        }\n\n        .naver-list li {\n            margin: 0 10px;\n        }\n\n        .naver-list a {\n            text-decoration: none;\n            color: #fff;\n            font-weight: bold;\n            transition: color 0.3s;\n        }\n\n        .naver-list a:hover {\n            color: #ff4500; \/* Change to your desired hover color *\/\n        }\n\n        \/* Style the main content area *\/\n        #content {\n            margin: 20px;\n            padding: 20px;\n            border: 1px solid #ccc;\n            background-color: #f9f9f9;\n            box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);\n        }\n\n        ul {\n            margin: 0;\n            padding: 0;\n        }\n\n\n    <\/style>\n\n<\/head>\n<body>\n        <h1>Seasonal Premium Calculator<\/h1>\n    <div id = 'head'>\n        <nav class=\"naver\">\n            <ul class=\"naver-list\">\n                <li><a href=\"https:\/\/www.germaniamutual.com\/g\/premiumcalculator\/\" >Cancelation<\/a><\/li>\n                <li><a href=\"https:\/\/www.germaniamutual.com\/g\/endorsementcalculator\/\" id=\"page2-link\">Endorsement<\/a><\/li>\n                <li><a href=\"https:\/\/www.germaniamutual.com\/g\/seasonalcalculator\/\" id=\"page3-link\">Seasonal<\/a><\/li>\n            <\/ul>\n        <\/nav>\n    <\/div>\n\n    <br>\n    <div class=\"date-label\">\n        <label for=\"startDate\">Start Date<\/label>\n        <input type=\"date\" id=\"startDate\" value=\"2023-01-01\">\n    <\/div>\n    <div class=\"date-label\">\n        <label for=\"endDate\">Cancel Date<\/label>\n        <input type=\"date\" id=\"endDate\" value=\"2023-01-01\">\n    <\/div>\n\n    <div>\n        <br>\n    <label class =\"switch\">\n        <input type =\"checkbox\" id = 'summerwinter'>\n        <span class=\"slider\">\n        <\/span>\n    <\/label>\n    <div>\n\n    <br>\n    <br>\n    <label for=\"premium\">Premium Paid<\/label>\n    <br>\n    $<input type=\"text\" id=\"premium\" value=\"0\"><br><br>\n\n    <button onclick=\"calculate()\">Calculate<\/button><br><br>\n    <p>Days In Force - <span id=\"daysInForce\">0<\/span><\/p>       \n\n    \n    <div class=\"section-container\">\n        <h2 class=\"section-title\">&nbsp; <\/h2>\n        <div class=\"section-content\">\n            <p>Percent Retained<\/p>\n            <p>Amount Retained<\/p>\n            <p>Amount Refund<\/p>\n        <\/div>\n    <\/div>\n\n    <div class=\"section-container\">\n        <h2 class=\"section-title\">Pro-Rata<\/h2>\n        <div class=\"section-content\">\n            <p><span id=\"percentRetainedProRata\">0%<\/span><\/p>\n            <p>$<span id=\"amountRetainedProRata\">0.00<\/span><\/p>\n            <p>$<span id=\"amountRefundProRata\">0.00<\/span><\/p>\n        <\/div>\n    <\/div>\n\n<br><br>\n    <!--<div class=\"section-container-noborder\">\n    <a href  = 'https:\/\/www.germaniamutual.com\/g\/endorsementcalculator\/' class = \"no-link\">\n        <button class=\"arrow-button\">Endorsement Calculator<span class=\"arrow\"><\/span>\n        <\/button>\n    <\/a>\n    <div>-->\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"<p>Premium Cancellation Calculator Seasonal Premium Calculator Cancelation Endorsement Seasonal Start Date Cancel Date Premium Paid $ Calculate Days In Force &#8211; 0 &nbsp; Percent Retained Amount Retained Amount Refund Pro-Rata 0% $0.00 $0.00<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-7750","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/pages\/7750","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/comments?post=7750"}],"version-history":[{"count":9,"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/pages\/7750\/revisions"}],"predecessor-version":[{"id":7825,"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/pages\/7750\/revisions\/7825"}],"wp:attachment":[{"href":"https:\/\/www.germaniamutual.com\/g\/wp-json\/wp\/v2\/media?parent=7750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}