All checks were successful
continuous-integration/drone/push Build is passing
26 lines
804 B
Python
26 lines
804 B
Python
"""
|
||
Общие вспомогательные функции
|
||
"""
|
||
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
|