#!/usr/bin/env python3 from datetime import datetime, timedelta def calculate_reach_date(current_hours, max_hours, hours_added_bi_weekly): """ Calculate the date when the maximum allowed hours will be reached. Parameters: - current_hours (float): The current total hours provided by the user. - max_hours (float): The maximum hours allowed. - hours_added_bi_weekly (float): The number of hours added every two weeks. Returns: - datetime.date: The estimated date when the max hours will be reached. """ # Calculate the difference needed to reach max hours_needed = max_hours - current_hours # Calculate the number of bi-weekly periods needed bi_weekly_periods_needed = hours_needed / hours_added_bi_weekly # Calculate the days needed days_needed = bi_weekly_periods_needed * 14 # 14 days in 2 weeks # Calculate the reach date current_date = datetime.now() reach_date = current_date + timedelta(days=days_needed) return reach_date # Constants MAX_HOURS = 240 HOURS_ADDED_BI_WEEKLY = 6.15384615 # HOURS_ADDED_BI_WEEKLY = 7.69230769 LAST_KNOWN_PTO_BALANCE = 220.08 # Example last known PTO balance # Display the last known PTO balance for easy copying print(f"Last known PTO balance: {LAST_KNOWN_PTO_BALANCE}") # User input with a prompt that includes the copy-paste line current_hours_input = input("Enter the current hours (copy and paste the 'Last known PTO balance' here): ") # Convert input to float current_hours = float(current_hours_input.strip()) # Calculate reach_date = calculate_reach_date(current_hours, MAX_HOURS, HOURS_ADDED_BI_WEEKLY) # Output print(f"Current date: {datetime.now().strftime('%Y-%m-%d')}") print(f"You will reach the maximum hours on: {reach_date.strftime('%Y-%m-%d')}")