# Get the maintenance start and end dates maint_start_date = input_fields.get('maint_start_date') maint_end_date = input_fields.get('maint_end_date')
# Check if the dates are not None and are valid datetime objects if maint_start_date is None or maint_end_date is None: raise ValueError("Maintenance start date or end date is missing.")
# Assuming the dates are in string format, convert them to datetime objects maint_start_date = datetime.strptime(maint_start_date, '%Y-%m-%d') maint_end_date = datetime.strptime(maint_end_date, '%Y-%m-%d')
# Format the dates as strings maintDate = maint_start_date.strftime('%Y-%m-%d') + " to " + maint_end_date.strftime('%Y-%m-%d')
Hey @ahmedbs, thank you for posting in our Community!
Looks like the issue lies in the variable name mismatch in your return statement. You defined the variable as maintDate but returned it as maint_date. Python is case-sensitive, so maintDate and maint_date are treated as different variables.
Hey @ahmedbs, thank you for posting in our Community!
Looks like the issue lies in the variable name mismatch in your return statement. You defined the variable as maintDate but returned it as maint_date. Python is case-sensitive, so maintDate and maint_date are treated as different variables.