Race Calculator Pace

Race Pace Calculator: Calculate Your Running Speed & Splits :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –white: #fff; –shadow-color: rgba(0, 0, 0, 0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; padding-top: 20px; padding-bottom: 40px; } .container { width: 100%; max-width: 960px; background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 4px 12px var(–shadow-color); text-align: center; margin-bottom: 40px; } h1, h2, h3 { color: var(–primary-color); } h1 { font-size: 2.5em; margin-bottom: 15px; } h2 { font-size: 1.8em; margin-top: 30px; margin-bottom: 20px; border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; } h3 { font-size: 1.4em; margin-top: 25px; margin-bottom: 15px; } .race-calc-container { background-color: var(–white); padding: 25px; border-radius: 8px; box-shadow: 0 2px 8px var(–shadow-color); margin-bottom: 30px; display: flex; flex-direction: column; align-items: center; } .input-group { margin-bottom: 20px; width: 100%; max-width: 400px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { width: calc(100% – 20px); padding: 12px; border: 1px solid var(–border-color); border-radius: 4px; font-size: 1em; box-sizing: border-box; } .input-group input[type="number"]:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85em; color: #666; margin-top: 5px; display: block; } .error-message { color: #dc3545; font-size: 0.8em; margin-top: 5px; display: block; height: 1.2em; /* Reserve space */ } .button-group { display: flex; justify-content: center; gap: 15px; margin-top: 25px; flex-wrap: wrap; /* Allow wrapping on smaller screens */ } .btn { padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; text-transform: uppercase; } .btn-primary { background-color: var(–primary-color); color: var(–white); } .btn-primary:hover { background-color: #003366; transform: translateY(-2px); } .btn-secondary { background-color: #6c757d; color: var(–white); } .btn-secondary:hover { background-color: #5a6268; transform: translateY(-2px); } .btn-success { background-color: var(–success-color); color: var(–white); } .btn-success:hover { background-color: #218838; transform: translateY(-2px); } #results { margin-top: 30px; padding: 25px; border: 1px dashed var(–primary-color); border-radius: 8px; background-color: var(–background-color); display: flex; flex-direction: column; align-items: center; width: 100%; box-sizing: border-box; } #results h3 { margin-top: 0; color: var(–text-color); border-bottom: none; } .result-item { margin-bottom: 15px; font-size: 1.1em; width: 100%; max-width: 500px; } .result-item strong { color: var(–primary-color); font-size: 1.3em; display: block; margin-bottom: 5px; } .result-item .label { font-weight: bold; display: inline-block; min-width: 180px; } .result-item .value { font-weight: bold; font-size: 1.2em; color: var(–primary-color); } .result-explanation { font-size: 0.9em; color: #555; margin-top: 10px; text-align: left; width: 100%; max-width: 500px; } #chartContainer { margin-top: 30px; width: 100%; max-width: 700px; background-color: var(–white); padding: 20px; border-radius: 8px; box-shadow: 0 2px 8px var(–shadow-color); } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 15px; text-align: left; } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 1px 5px var(–shadow-color); } th, td { padding: 12px 15px; text-align: left; border: 1px solid #ddd; } th { background-color: var(–primary-color); color: var(–white); font-weight: bold; } tr:nth-child(even) { background-color: #f2f2f2; } tr:hover { background-color: #e9ecef; } .article-content { text-align: left; width: 100%; max-width: 960px; background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 4px 12px var(–shadow-color); margin-top: 40px; } .article-content p, .article-content ul, .article-content ol { margin-bottom: 20px; font-size: 1.05em; } .article-content li { margin-bottom: 10px; } .article-content a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .faq-item { margin-bottom: 20px; padding: 15px; border: 1px solid #eee; border-radius: 5px; background-color: #fdfdfd; } .faq-item h4 { margin: 0 0 10px 0; color: var(–primary-color); font-size: 1.1em; } .related-tools ul { list-style: none; padding: 0; } .related-tools li { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px dashed #eee; } .related-tools li:last-child { border-bottom: none; } .related-tools a { font-weight: bold; } .related-tools span { font-size: 0.9em; color: #555; display: block; margin-top: 5px; } .highlight-result { background-color: var(–success-color); color: var(–white); padding: 15px; border-radius: 6px; font-size: 1.5em; font-weight: bold; margin-top: 20px; margin-bottom: 20px; display: inline-block; box-shadow: 0 2px 6px rgba(40, 167, 69, 0.4); } /* Responsive adjustments */ @media (max-width: 768px) { .container, .article-content { padding: 20px; } h1 { font-size: 2em; } h2 { font-size: 1.5em; } h3 { font-size: 1.2em; } .btn { width: 100%; margin-bottom: 10px; } .button-group { flex-direction: column; align-items: center; } .result-item .label { min-width: unset; display: block; margin-bottom: 5px; } #results { padding: 20px; } .result-item strong { font-size: 1.2em; } }

Race Pace Calculator

Calculate your required running pace for different race distances based on your target finish time, or estimate your finish time based on a desired pace.

Pace & Time Calculator

Enter the race distance (e.g., 5 for 5k, 13.1 for half marathon, 26.2 for marathon).
Kilometers (km) Miles (mi)
Enter your desired finish time.

Your Race Pace & Time Breakdown

Target Pace:
This is the average pace you need to maintain per unit of distance to achieve your target finish time.
Estimated Finish Time:
Speed (km/h):
Speed (mph):
Split Time (per km):
Split Time (per mile):

Key Assumptions:

Distance Unit:

Target Time:

Pace vs. Speed Comparison
Pace Conversion Table
Pace (min/km) Pace (min/mi) Speed (km/h) Speed (mph)
Enter values above to populate table.

What is a Race Pace Calculator?

A Race Pace Calculator is a specialized tool designed for runners, cyclists, and other endurance athletes to help them determine the optimal speed or pace required to achieve a specific finish time over a set race distance. It bridges the gap between a desired outcome (finishing a race by a certain time) and the effort needed to get there (maintaining a consistent pace). This race calculator pace is essential for effective training and race strategy. For many athletes, understanding and calculating race pace is a crucial part of their preparation, turning theoretical goals into actionable training plans. It's not just about speed; it's about efficiency and consistency. This tool can help you quantify those elements, making your race planning more precise.

Who Should Use It:

  • Runners training for 5Ks, 10Ks, half marathons, marathons, and ultramarathons.
  • Cyclists preparing for road races or time trials.
  • Triathletes aiming for specific leg times within their race.
  • Anyone looking to improve their performance in timed endurance events.
  • Beginner athletes trying to set realistic goals.
  • Experienced athletes seeking to refine their race strategy.

Common Misconceptions:

  • Misconception: Race pace is just your maximum speed.
    Reality: Race pace is a *sustainable* speed for the duration of the event. It's often significantly slower than your sprint speed.
  • Misconception: The calculator provides a guaranteed finish time.
    Reality: The calculator provides a target pace based on inputs; actual race performance depends on training, conditions, nutrition, and race day execution.
  • Misconception: All race pace calculators are the same.
    Reality: While the core formula is consistent, variations in units, precision, and additional features can differ. Our race calculator pace tool aims for clarity and comprehensive output.

{primary_keyword} Formula and Mathematical Explanation

The core of the race pace calculator lies in a few fundamental physics and mathematics principles. At its heart, it relates distance, time, and speed (or pace). Pace is often expressed as time per unit of distance, while speed is distance per unit of time. They are inverse concepts.

The Primary Formula:

The most basic relationship is:

Distance = Speed × Time

From this, we derive:

Speed = Distance / Time

And, crucially for runners:

Pace = Time / Distance

Calculating Pace from Target Time and Distance:

  1. Convert the target finish time entirely into a single unit (e.g., seconds or minutes).
  2. Divide the total time by the race distance.

Example: Target time is 2 hours (7200 seconds) for a 10k race (10,000 meters).
Pace = 7200 seconds / 10 km = 720 seconds/km.
To convert seconds/km to min/km: 720 seconds / 60 seconds/minute = 12 minutes/km.

Calculating Finish Time from Pace and Distance:

  1. Ensure pace and distance units are compatible (e.g., min/km and km).
  2. Multiply the pace by the distance.
  3. Convert the resulting time back into hours, minutes, and seconds.

Example: Pace is 5:00 min/km for a 5k race.
Total Time = 5 minutes/km × 5 km = 25 minutes.
This is 0 hours, 25 minutes, and 0 seconds.

Calculating Speed:

Speed is the inverse of pace. If pace is time/distance, speed is distance/time.

Speed = Distance / Time

To get speed in km/h or mph, ensure distance is in km or miles and time is in hours.

Example: To achieve a 5:00 min/km pace (which is 12 km/h if you do the math: 60 min / 5 min/km = 12 km/h):
If you maintain 12 km/h for 1 hour, you cover 12 km. This confirms the pace.

Variable Explanations and Table

Here are the key variables used in our race pace calculator:

Variable Meaning Unit Typical Range / Notes
Distance The length of the race or segment being calculated. Kilometers (km) or Miles (mi) 0.1 km to 1000+ km / 0.1 mi to 1000+ mi
Target Time The desired total time to complete the race. Hours, Minutes, Seconds Any realistic positive duration.
Pace The time required to cover a specific unit of distance. Minutes per Kilometer (min/km) or Minutes per Mile (min/mi) Varies widely based on athlete ability and distance (e.g., 3:00 min/km for elite 5k, 10:00 min/mi for recreational marathoners).
Speed The distance covered per unit of time. Kilometers per Hour (km/h) or Miles per Hour (mph) Calculated based on pace and distance unit. (e.g., 12 km/h corresponds to 5:00 min/km pace).

Practical Examples (Real-World Use Cases)

Example 1: Training for a 10k Race

Scenario: Sarah is training for her first 10k race. She wants to finish in under 60 minutes. She needs to know what pace to aim for.

Inputs:

  • Race Distance: 10 km
  • Distance Unit: Kilometers (km)
  • Target Time: 0 Hours, 55 Minutes, 0 Seconds

Calculation:

  • Total Target Time in minutes = 55 minutes.
  • Required Pace = 55 minutes / 10 km = 5.5 minutes/km.
  • Convert 0.5 minutes to seconds: 0.5 * 60 = 30 seconds.
  • Target Pace: 5:30 min/km
  • Estimated Finish Time: 55:00
  • Speed (km/h): 60 / 5.5 = 10.91 km/h
  • Speed (mph): 10.91 km/h / 1.60934 = 6.77 mph
  • Split Time (per km): 5:30
  • Split Time (per mile): (55 minutes / 10 km) * 1.60934 km/mi = 8.85 minutes/mi ≈ 8:51 min/mi

Interpretation: Sarah needs to consistently run at an average pace of 5 minutes and 30 seconds per kilometer to achieve her goal of finishing the 10k in 55 minutes. This information helps her structure her training runs and pacing strategy during the race.

Example 2: Estimating Marathon Finish Time

Scenario: John has been running consistently and wants to estimate his finish time for an upcoming marathon. His training runs suggest he can comfortably maintain a pace of around 8:00 minutes per mile.

Inputs:

  • Race Distance: 26.2 miles
  • Distance Unit: Miles (mi)
  • Target Pace: 8:00 min/mi (This means the calculator needs to work backward or we input it as a pace)

Using the calculator by setting a pace: If the calculator was designed to input pace directly:

  • Pace: 8 minutes 0 seconds per mile
  • Distance: 26.2 miles

Calculation (using the tool's logic for time from pace):

  • Total Time = 8 minutes/mile * 26.2 miles = 209.6 minutes.
  • Convert 209.6 minutes to hours and minutes:
  • Hours = floor(209.6 / 60) = 3 hours.
  • Remaining minutes = 209.6 – (3 * 60) = 209.6 – 180 = 29.6 minutes.
  • Convert 0.6 minutes to seconds: 0.6 * 60 = 36 seconds.
  • Estimated Finish Time: 3:29:36
  • Required Pace: 8:00 min/mi
  • Speed (mph): 60 minutes / 8 minutes/mile = 7.5 mph
  • Speed (km/h): 7.5 mph * 1.60934 km/mi ≈ 12.07 km/h
  • Split Time (per km): (8 minutes/mile) / 1.60934 km/mi ≈ 4.97 minutes/km ≈ 4:58 min/km
  • Split Time (per mile): 8:00

Interpretation: If John can maintain an 8:00 min/mile pace, he can expect to finish the marathon in approximately 3 hours, 29 minutes, and 36 seconds. This helps him set a realistic goal and focus his training on hitting that specific pace.

How to Use This Race Pace Calculator

Using our race pace calculator is straightforward. Follow these steps to get your personalized pace and time estimations:

  1. Input Race Distance: Enter the total distance of your race in the "Race Distance" field.
  2. Select Distance Unit: Choose whether your distance is in "Kilometers (km)" or "Miles (mi)" using the dropdown menu. This is crucial for accurate pace calculation.
  3. Enter Target Time: Input your desired finish time into the "Target Time" fields (Hours, Minutes, Seconds). You can enter any combination that makes sense for your goal. For example, for a 10k in under an hour, you might enter 59 minutes and 59 seconds, or even just 55 minutes if you're ambitious.
  4. Click "Calculate": Once all fields are populated, click the "Calculate" button. The calculator will process your inputs instantly.
  5. Review Results: The calculator will display:
    • Primary Result (Target Pace): This is the core output, showing the average pace (e.g., min/km or min/mi) you need to maintain.
    • Estimated Finish Time: Your projected finish time based on the pace required for the entered distance and time.
    • Speed: Calculated speed in both km/h and mph for broader context.
    • Split Times: The equivalent pace for the other distance unit (e.g., min/mi if you calculated in min/km).
  6. Use the Table and Chart: The table provides quick pace conversions, and the chart visualizes the relationship between pace and speed.
  7. Reset or Copy: Use the "Reset" button to clear all fields and start over. Use "Copy Results" to easily share your calculated pace information.

How to Read Results: The most important figure is your Target Pace. This tells you how fast you need to run each kilometer or mile. For example, a pace of "6:00 min/km" means you need to complete each kilometer in exactly 6 minutes. Your Estimated Finish Time confirms your goal feasibility.

Decision-Making Guidance:

  • Realistic Goal Setting: If the calculated pace seems unattainable based on your current fitness, adjust your target time to something more realistic. Conversely, if it seems too easy, you might be underestimating your potential.
  • Training Intensity: Use the target pace to guide your interval training, tempo runs, and long runs. Your training paces should often be faster or slower than your target race pace to build speed and endurance.
  • Race Day Strategy: Aim to run close to your target pace, especially in the early stages. Avoid going out too fast, which can lead to burnout. Use mile or kilometer markers to check your splits against your target pace.

Key Factors That Affect Race Pace Results

While the race pace calculator provides a solid mathematical foundation, several real-world factors significantly influence your ability to achieve your calculated pace on race day. Understanding these factors is key to effective race preparation and management.

  1. Current Fitness Level: This is paramount. The calculator assumes you *can* maintain a certain pace. Your current cardiovascular fitness, muscular endurance, and running economy dictate your actual capability. Pushing too hard too soon leads to injury or burnout.
  2. Training Consistency and Specificity: Regular training that mimics race conditions (distance, terrain, intensity) is crucial. Training at or slightly faster than your target race pace builds the necessary physiological adaptations. Lack of consistent training means the calculated pace might be aspirational rather than achievable.
  3. Race Day Conditions: Weather plays a massive role. High temperatures, humidity, strong headwinds, or even heavy rain can significantly slow you down, making it harder to hit your target pace. Conversely, cool, calm conditions can sometimes allow you to exceed your pace goal.
  4. Course Profile (Terrain): A flat course allows for a more consistent pace compared to a hilly or mountainous one. Uphills require more effort and slow you down, while downhills might offer a slight recovery but can also pose risks (e.g., jarring impacts). The calculator typically assumes a flat course unless otherwise specified.
  5. Nutrition and Hydration: Proper fueling before and during the race is vital for sustained energy. Inadequate glycogen stores or dehydration can lead to a significant drop in performance (hitting the "wall"), making it impossible to maintain your calculated pace.
  6. Race Strategy and Pacing Execution: How you execute your race plan matters. Starting too fast often leads to fading in the later stages. A well-executed strategy involves starting at or slightly slower than your target pace, settling in, and potentially increasing effort if feeling strong towards the end. The calculator provides the *target*, but *you* must execute it.
  7. Tapering and Recovery: Adequate rest and recovery leading up to the race (tapering) allow your body to be fresh and ready. Overtraining or insufficient rest can leave you fatigued, hindering your ability to perform at your calculated pace.
  8. Mental Strength: Endurance events are as much mental as physical. Maintaining focus, pushing through discomfort, and believing in your ability to hold the pace are critical components that the calculator cannot quantify.

Frequently Asked Questions (FAQ)

Q1: What is the difference between pace and speed?

A: Pace is time per unit of distance (e.g., minutes per mile), commonly used by runners. Speed is distance per unit of time (e.g., miles per hour), more often used in general physics or by cyclists. They are inversely related; a faster pace means higher speed, and vice versa.

Q2: Can I use this calculator for cycling or swimming?

A: Yes, the fundamental calculations (distance, time, pace/speed) apply to many endurance sports. However, cycling and swimming speeds/paces differ significantly due to biomechanics and equipment. While the numbers work mathematically, ensure the resulting pace is realistic for that specific sport.

Q3: My calculated pace seems too fast/slow. What should I do?

A: Use this calculator as a guide, not a definitive decree. If the pace seems unrealistic, adjust your target time downwards (for a slower pace) or upwards (for a faster pace) based on your training and experience. Your training logs are the best indicator of your true potential.

Q4: How do I convert between min/km and min/mi pace?

A: To convert pace: Pace (min/mi) = Pace (min/km) * 1.60934. To convert pace: Pace (min/km) = Pace (min/mi) / 1.60934. Our calculator handles these conversions automatically.

Q5: What does "Split Time" mean in the results?

A: "Split Time" refers to the pace required for the specified unit of distance. If you are calculating for kilometers, the "Split Time (per km)" shows your target pace per kilometer. The "Split Time (per mile)" shows the equivalent pace per mile, which is useful for context if you train or race using both units.

Q6: Does the calculator account for course elevation?

A: No, this calculator assumes a flat course. Significant elevation changes (hills) will alter your actual pace. You may need to adjust your target pace based on the known elevation profile of your race.

Q7: How accurate is the "Estimated Finish Time"?

A: The Estimated Finish Time is mathematically accurate based on the inputs. However, real-world race performance depends heavily on factors like weather, course, nutrition, and your execution on race day. It's a projection, not a guarantee.

Q8: Can I use this calculator to plan my training paces?

A: Absolutely. Your target race pace is a key reference point. You'll often use paces slower than your race pace for long runs (endurance) and paces faster than your race pace for speed work (intervals, tempo runs) to improve your overall fitness and ensure you can comfortably hit your target on race day.

var chartInstance = null; // To hold chart instance function formatTime(totalSeconds) { var hours = Math.floor(totalSeconds / 3600); var minutes = Math.floor((totalSeconds % 3600) / 60); var seconds = Math.floor(totalSeconds % 60); minutes = minutes < 10 ? "0" + minutes : minutes; seconds = seconds 0) { return hours + ":" + minutes + ":" + seconds; } else { return minutes + ":" + seconds; } } function formatPace(totalMinutes) { if (isNaN(totalMinutes) || totalMinutes < 0) return "–"; var minutes = Math.floor(totalMinutes); var seconds = Math.floor((totalMinutes – minutes) * 60); seconds = seconds < 10 ? "0" + seconds : seconds; return minutes + ":" + seconds; } function calculatePace() { // Reset errors document.getElementById('distanceError').textContent = ''; document.getElementById('targetTimeError').textContent = ''; var distanceInput = document.getElementById('distance'); var distanceUnitSelect = document.getElementById('distanceUnit'); var targetTimeHoursInput = document.getElementById('targetTimeHours'); var targetTimeMinutesInput = document.getElementById('targetTimeMinutes'); var targetTimeSecondsInput = document.getElementById('targetTimeSeconds'); var distance = parseFloat(distanceInput.value); var distanceUnit = distanceUnitSelect.value; var targetTimeHours = parseFloat(targetTimeHoursInput.value) || 0; var targetTimeMinutes = parseFloat(targetTimeMinutesInput.value) || 0; var targetTimeSeconds = parseFloat(targetTimeSecondsInput.value) || 0; // Validate inputs var isValid = true; if (isNaN(distance) || distance <= 0) { document.getElementById('distanceError').textContent = 'Please enter a valid positive distance.'; isValid = false; } if (isNaN(targetTimeHours) || targetTimeHours < 0 || isNaN(targetTimeMinutes) || targetTimeMinutes < 0 || isNaN(targetTimeSeconds) || targetTimeSeconds 0) { paceDataKm.push({ x: dist, y: currentPaceKm }); } else { paceDataKm.push({ x: dist, y: null }); } if (!isNaN(currentSpeedKmph) && currentSpeedKmph > 0) { speedDataKmph.push({ x: dist, y: currentSpeedKmph }); } else { speedDataKmph.push({ x: dist, y: null }); } }); chartInstance = new Chart(ctx, { type: 'line', data: { datasets: [{ label: 'Pace (min/km)', data: paceDataKm, borderColor: 'rgb(0, 74, 153)', backgroundColor: 'rgba(0, 74, 153, 0.1)', tension: 0.1, fill: false }, { label: 'Speed (km/h)', data: speedDataKmph, borderColor: 'rgb(40, 167, 69)', backgroundColor: 'rgba(40, 167, 69, 0.1)', tension: 0.1, fill: false }] }, options: { responsive: true, maintainAspectRatio: true, scales: { x: { type: 'linear', position: 'bottom', title: { display: true, text: 'Distance (km)' } }, y: { title: { display: true, text: 'Value' } } }, plugins: { legend: { position: 'top', }, title: { display: true, text: 'Pace and Speed Relationship Across Distances' } } } }); } function resetCalculator() { document.getElementById('distance').value = '10'; document.getElementById('distanceUnit').value = 'km'; document.getElementById('targetTimeHours').value = '0'; document.getElementById('targetTimeMinutes').value = '59'; document.getElementById('targetTimeSeconds').value = '59'; document.getElementById('distanceError').textContent = "; document.getElementById('targetTimeError').textContent = "; updateDistanceUnitLabel(); // Update helper text if needed calculatePace(); } function copyResults() { var mainResultElement = document.getElementById('mainResult'); var primaryPace = mainResultElement.querySelector('.value').textContent; var primaryUnit = primaryPace.split('/')[1].trim(); var primaryPaceValue = primaryPace.split('/')[0].trim(); var finishTime = document.querySelector('#results .result-item:nth-child(3) .value').textContent; var speedKmph = document.querySelector('#results .result-item:nth-child(4) .value').textContent; var speedMph = document.querySelector('#results .result-item:nth-child(5) .value').textContent; var splitKm = document.querySelector('#results .result-item:nth-child(6) .value').textContent; var splitMi = document.querySelector('#results .result-item:nth-child(7) .value').textContent; var assumptionUnit = document.getElementById('assumptionUnit').textContent; var assumptionTime = document.getElementById('assumptionTime').textContent; var textToCopy = "— Race Pace Calculator Results —\n\n"; textToCopy += "Primary Target Pace: " + primaryPaceValue + " / " + primaryUnit + "\n"; textToCopy += "Estimated Finish Time: " + finishTime + "\n"; textToCopy += "Speed: " + speedKmph + " | " + speedMph + "\n"; textToCopy += "Split Time (per km): " + splitKm + "\n"; textToCopy += "Split Time (per mile): " + splitMi + "\n\n"; textToCopy += "Key Assumptions:\n"; textToCopy += "Distance Unit: " + assumptionUnit + "\n"; textToCopy += "Target Time: " + assumptionTime + "\n"; textToCopy += "\n———————————-"; navigator.clipboard.writeText(textToCopy).then(function() { alert('Results copied to clipboard!'); }, function(err) { console.error('Failed to copy: ', err); alert('Failed to copy results. Please copy manually.'); }); } function updateDistanceUnitLabel() { var unit = document.getElementById('distanceUnit').value; var helperTextElement = document.querySelector('#distance + .helper-text'); if (helperTextElement) { helperTextElement.textContent = 'Enter the race distance (e.g., 5 for 5k, 13.1 for half marathon, 26.2 for marathon).'; if (unit === 'miles') { helperTextElement.textContent = 'Enter the race distance (e.g., 3.1 for 5k, 13.1 for half marathon, 26.2 for marathon).'; } } } // Initial setup document.addEventListener('DOMContentLoaded', function() { resetCalculator(); // Set default values on load updateDistanceUnitLabel(); // Ensure initial helper text is correct // Initialize chart with placeholder data or null var canvas = document.getElementById('paceChart'); if (canvas) { var ctx = canvas.getContext('2d'); chartInstance = new Chart(ctx, { type: 'line', data: { datasets: [] }, // Empty datasets initially options: { responsive: true, maintainAspectRatio: true, scales: { x: { display: false }, // Hide initially y: { display: false } // Hide initially }, plugins: { legend: { display: false }, title: { display: false } } } }); } });

Leave a Comment