Skip to content

Conversation

Ericbutler1209
Copy link

This PR fixes syntax errors and improves the Age Calculator:

  • Replace invalid leap-year function with a valid version using calendar.isleap
  • Ensure function calls consistently use judge_leap
  • Add a friendly breakdown of age in days, hours, minutes, and seconds

Copy link
Contributor

👋 @Ericbutler1209 👋

We're delighted to have your pull request! Please take a moment to check our contributing guidelines and ensure you've filled out the PR template for a smooth process. We will review it soon.

@king04aman king04aman requested a review from Copilot September 25, 2025 20:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes critical bugs in the Age Calculator and enhances user experience by adding a detailed breakdown of age in multiple time units.

  • Fix leap year function name inconsistency and simplify implementation
  • Convert user age input to integer and add proper type annotations
  • Add friendly time breakdown showing age in days, hours, minutes, and seconds
Comments suppressed due to low confidence (1)

Age Calculator/calculate.py:1

  • Missing the addition of current day to the total day count. The line day = day + localtime.tm_mday was removed but not replaced, causing the current day of the month to be excluded from the calculation.
import time

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +44 to +47
# Approximate breakdown (ignores time of day)
hours = day * 24
minutes = hours * 60
seconds = minutes * 60
Copy link
Preview

Copilot AI Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The age calculation is incomplete as it's missing the current day addition (line 44 in original code). Without adding localtime.tm_mday, the day count will be short by the current day of the month, making all subsequent time calculations inaccurate.

Copilot uses AI. Check for mistakes.

@king04aman
Copy link
Owner

Hi @Ericbutler1209 ,

Thanks for your contribution. The current age breakdown misses adding the current day (localtime.tm_mday), which makes the day/hour/minute/second calculations inaccurate. Please fix the day calculation and add/update tests to cover this case before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants