@@ -32,70 +32,6 @@ def __init__(self):
3232 self .mapping_manager = MappingManager ()
3333 self .logger = get_logger ()
3434
35- def _is_date_in_past (self , start_time : str , grace_hours : int = 12 ) -> bool :
36- """
37- Check if the given start_time is in the past.
38-
39- Args:
40- start_time: ISO format datetime string ending with 'Z' (e.g., "2025-04-24T14:00:00Z")
41- grace_hours: Number of hours of grace period to allow (default 12 hours to allow editing during and after meetings)
42-
43- Returns:
44- True if the date is more than grace_hours in the past, False otherwise
45- """
46- try :
47- # Only check properly formatted ISO dates
48- if not isinstance (start_time , str ) or not start_time .endswith ('Z' ):
49- # If we can't parse the date, don't block - let other validation handle it
50- return False
51-
52- # Parse the ISO datetime string
53- parsed_time = datetime .fromisoformat (start_time .replace ('Z' , '+00:00' ))
54-
55- # Get current UTC time
56- now = datetime .now (timezone .utc )
57-
58- # Calculate the difference
59- time_diff = now - parsed_time
60-
61- # Check if it's more than grace_hours in the past
62- grace_seconds = grace_hours * 3600
63- is_past = time_diff .total_seconds () > grace_seconds
64-
65- if is_past :
66- self .logger .info (f"Date { start_time } is in the past (current time: { now .isoformat ()} )" )
67-
68- return is_past
69-
70- except Exception as e :
71- self .logger .error (f"Failed to check if date is in past: { e } " )
72- # On error, don't block - let other processes handle it
73- return False
74-
75- def _post_past_date_comment (self , issue , start_time : str ) -> None :
76- """Post a comment explaining that the selected date is in the past."""
77- try :
78- comment_text = f"""⚠️ **Past Date Detected**
79-
80- The date/time you selected (`{ start_time } `) appears to be in the past.
81-
82- **No resources were created** to avoid scheduling conflicts.
83-
84- **To fix this:**
85- 1. Click the "Edit" button on this issue
86- 2. Update the "UTC Date & Time" field to a future date
87- 3. Save your changes
88-
89- The bot will automatically process your issue once the date is corrected.
90-
91- 💡 **Tip**: Double-check the year! Common mistake: using last year's date by accident."""
92-
93- issue .create_comment (comment_text )
94- self .logger .info (f"Posted past date comment to issue #{ issue .number } " )
95-
96- except Exception as e :
97- self .logger .error (f"Failed to post past date comment: { e } " )
98-
9935 def _apply_autopilot_defaults (self , form_data : Dict , issue ) -> Dict :
10036 """
10137 Apply autopilot defaults if enabled and applicable.
@@ -369,13 +305,6 @@ def handle_protocol_call(self, issue_number: int, repo_name: str) -> bool:
369305 self .logger .error (f"Failed to validate/transform data for issue #{ issue_number } " )
370306 return False
371307
372- # 3.5. Check if the date is in the past
373- start_time = call_data .get ("start_time" )
374- if self ._is_date_in_past (start_time ):
375- self .logger .warning (f"Issue #{ issue_number } has a past date: { start_time } " )
376- self ._post_past_date_comment (issue , start_time )
377- return False
378-
379308 # 4. Check for existing occurrence and resources
380309 existing_occurrence = self .mapping_manager .find_occurrence (issue_number )
381310 is_update = existing_occurrence is not None
@@ -1541,9 +1470,9 @@ def _generate_comprehensive_resource_comment(self, call_data: Dict) -> Optional[
15411470 "⚠️ **Date Parsing Issue**: The date/time format could not be parsed automatically." ,
15421471 f" Current value: `{ start_time } `" ,
15431472 " Please edit the issue and use one of these formats:" ,
1544- " • `April 24, 2025 , 14:00 UTC`" ,
1545- " • `Apr 24, 2025 , 14:00 UTC`" ,
1546- " • `2025 -04-24T14:00:00Z`" ,
1473+ " • `April 24, 2026 , 14:00 UTC`" ,
1474+ " • `Apr 24, 2026 , 14:00 UTC`" ,
1475+ " • `2026 -04-24T14:00:00Z`" ,
15471476 ""
15481477 ])
15491478
0 commit comments