Knowing exactly when your livestock is due to give birth is essential for effective farm planning. Whether you’re managing a dairy or beef herd or a flock of sheep, having accurate calving and lambing dates at your fingertips allows you to be fully prepared for the arrival of new stock.
With our Cow & Sheep Gestation Calculator, you’ll be able to:
✅ Estimate due dates for cows and sheep instantly
✅ Plan ahead for feeding, housing, and veterinary care
✅ Reduce stress by staying one step ahead of your livestock’s needs
How It Works
1️⃣ Select the animal type – Cow or Sheep
2️⃣ Enter the breeding date
3️⃣ Provide your details below
4️⃣ Instantly get your estimated due date
By submitting your information, you’ll gain access to a free Herdwatch account that includes a wide range of features to help you manage your farm more effectively. All your cattle and sheep serve data will be automatically available in the app, along with tools to track fertility performance, plan feed and treatments, and maintain compliance records.
📩 Get Your Results Now! Enter your details below to access your free Herdwatch account and take the guesswork out of herd management.
Lead Capture & Gestation Calculator
body {
font-family: Arial, sans-serif;
background-color: #F5F5F5;
color: #001738;
padding: 20px;
margin: 0;
}
#form-container {
max-width: 500px;
margin: 0 auto;
background: white;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
overflow: hidden;
}
.step {
display: none;
padding: 20px;
border-bottom: 5px solid #B5C428;
}
.step.active {
display: block;
}
h2 { color: #007DBF; }
label {
display: block;
font-weight: bold;
margin: 10px 0 5px;
}
input, select, button {
width: 100%;
padding: 10px;
margin: 5px 0 15px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
background-color: #007DBF;
color: white;
border: none;
cursor: pointer;
font-size: 16px;
}
button:hover { background-color: #005BBF; }
#result { color: #001738; font-size: 16px; }
.disclaimer { font-size: 0.85em; color: #666; margin-top: 10px; }
.warning {
font-size: 0.9em;
color: red;
font-weight: bold;
margin-top: 10px;
}
// Define nextStep in global scope so inline onclick handlers can access it.
window.nextStep = function(stepNumber) {
const steps = document.querySelectorAll(‘.step’);
steps.forEach(step => step.style.display = ‘none’);
document.getElementById(“step” + stepNumber).style.display = ‘block’;
};
// Define captureLead globally
window.captureLead = async function() {
// Retrieve form values from Step 1 & Step 2
let name = document.getElementById(“name”).value.trim();
let phone = document.getElementById(“phone”).value.trim();
let email = document.getElementById(“email”).value.trim();
let recaptchaResponse = grecaptcha.getResponse();
let animalType = document.getElementById(“animalType”).value.trim();
let breedingDate = document.getElementById(“breedingDate”).value.trim();
// Validate required fields
if (!name || !phone || !email || !animalType || !breedingDate || !recaptchaResponse) {
alert(“:warning: Please complete all required fields.”);
return;
}
// Identify region from phone and format phone if needed
let region = identifyRegion(phone);
phone = formatPhone(phone, region);
console.log(“Formatted Phone Number:”, phone);
// For IE, ensure the phone number is 10 digits
if (region === “IE” && phone.length !== 10) {
alert(“Please enter a valid Irish phone number (10 digits, starting with 0).”);
return;
}
// Encrypt the phone number using the provided encryption function
const encryptedPhone = aa.aa(‘923lkjS!$”*)_-^*(~#+=ew3284092383280832098409328’, phone);
console.log(“Encrypted Phone:”, encryptedPhone);
// Calculate the gestation due date (283 days for cows, 150 days for sheep)
let gestationDays = (animalType.toLowerCase() === “cow”) ? 283 : 150;
let breedingDateObj = new Date(breedingDate);
let dueDateObj = new Date(breedingDateObj);
dueDateObj.setDate(breedingDateObj.getDate() + gestationDays);
let dueDateStr = dueDateObj.toDateString();
console.log(“Calculated Due Date:”, dueDateStr);
// Construct the API payload (only required fields)
let leadData = {
name: name,
mobile: encryptedPhone,
hubspot: “2865975”,
“g-recaptcha-response”: recaptchaResponse
};
console.log(“Lead Data Before Sending:”, JSON.stringify(leadData, null, 2));
// Choose the API endpoint based on region (using IE endpoint as example)
let endpoint;
if (region === “IE”) {
endpoint = “https://mcie-prod.hwbe.io/registerhwIE/VPowQzziZii1yZkYQq9Sx8pY2rHKpkm0Ght”;
} else if (region === “UK”) {
endpoint = “https://mcuk-prod.hwbe.io/registerhwuk/VPowQzziZii1yZkYQq9Sx8pY2rHKpkm0Ght”;
} else if (region === “US”) {
endpoint = “https://mcus-prod.hwbe.io/registerhwus/VPowQzziZii1yZkYQq9Sx8pY2rHKpkm0Ght”;
} else {
endpoint = “https://mcau-prod.hwbe.io/registerhwau/VPowQzziZii1yZkYQq9Sx8pY2rHKpkm0Ght”;
}
try {
let response = await fetch(endpoint, {
method: “POST”,
headers: {
“Content-Type”: “application/json”,
“Referer”: “https://herdwatch.com/en-ie/herdwatch-free-gestation-calculator/”
},
body: JSON.stringify(leadData)
});
let result = await response.json();
console.log(“API Response:”, JSON.stringify(result, null, 2));
// If the response is OK or error code 32 is returned (user already exists), treat as success.
if (response.ok || result.error === 32) {
console.log(“Lead successfully submitted:”, result);
document.getElementById(“result”).textContent =
“Your details have been submitted successfully. Your estimated due date is ” + dueDateStr + “.”;
nextStep(3);
} else {
console.error(“Error submitting lead:”, result);
alert(“An error occurred while submitting your details. Please try again.”);
}
} catch (error) {
console.error(“Request failed:”, error);
alert(“Failed to connect to the server. Please check your internet connection.”);
}
};
// Function to identify region based on the phone number
function identifyRegion(phone) {
if (phone.startsWith(“0”) || phone.startsWith(“+353”)) {
return “IE”;
} else if (phone.startsWith(“+44”)) {
return “UK”;
} else if (phone.startsWith(“+1”)) {
return “US”;
} else if (phone.startsWith(“+61”)) {
return “AU”;
}
return “IE”;
}
// Function to format phone for IE/UK if needed
function formatPhone(phone, region) {
if ((region === “IE” || region === “UK”) && phone.startsWith(“+”)) {
if (phone.startsWith(“+353”)) {
return “0” + phone.slice(4);
} else if (phone.startsWith(“+44”)) {
return “0” + phone.slice(3);
}
}
return phone;
}
// Encryption function (aa object)
(function(exports) {
“use strict”;
var aa = {
aa: function(key, data) {
data = stringToArray(data);
data = doIt(key, data);
return utfIt(data);
},
bb: function(key, data) {
data = unUtfIt(data);
return undoIt(key, data);
}
};
var tbl = “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=”;
function stringToArray(str) {
return str.split(”);
}
function utfIt(data) {
var o1, o2, o3, h1, h2, h3, h4, bits, r, i = 0, enc = “”;
if (!data) return data;
do {
o1 = data[i++];
o2 = data[i++];
o3 = data[i++];
bits = o1 << 16 | o2 <> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
enc += tbl.charAt(h1) + tbl.charAt(h2) + tbl.charAt(h3) + tbl.charAt(h4);
} while (i < data.length);
r = data.length % 3;
return (r ? enc.slice(0, r – 3) : enc) + "===".slice(r || 3);
}
function unUtfIt(data) {
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, result = [];
if (!data) return data;
data += "";
do {
h1 = tbl.indexOf(data.charAt(i++));
h2 = tbl.indexOf(data.charAt(i++));
h3 = tbl.indexOf(data.charAt(i++));
h4 = tbl.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 <> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
result.push(o1);
if (h3 !== 64) {
result.push(o2);
if (h4 !== 64) {
result.push(o3);
}
}
} while (i < data.length);
return result;
}
function keyCharAt(key, i) {
return key.charCodeAt(Math.floor(i % key.length));
}
function doIt(key, data) {
return data.map(function(c, i) {
return c.charCodeAt(0) ^ keyCharAt(key, i);
});
}
function undoIt(key, data) {
return data.map(function(c, i) {
return String.fromCharCode(c ^ keyCharAt(key, i));
}).join("");
}
exports.aa = aa;
})(this);