Files
parser/utils/helpers.py
Игорь Бандурист 25f2c09064
All checks were successful
continuous-integration/drone/push Build is passing
сделал ревью системы
2026-04-28 22:13:47 +10:00

26 lines
804 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
Общие вспомогательные функции
"""
from datetime import datetime as dt
def create_folder(num: int) -> str:
"""
Форматирует номер дня/месяца для имени папки (добавляет ведущий ноль)
"""
if int(num) // 10 == 0:
return f"0{num}"
else:
return str(num)
def get_current_date_parts() -> tuple[str, str, str]:
"""
Возвращает текущую дату в формате (год, месяц, день) с форматированием
"""
datetime_now = dt.now()
current_day = create_folder(datetime_now.day)
current_month = create_folder(datetime_now.month)
current_year = f"{datetime_now.year}"
return current_year, current_month, current_day