The updates for the customer dashboard cum accounts

This commit is contained in:
Vivek
2025-12-09 03:59:57 +05:30
parent 08a89a1212
commit 24355ecdf5
38 changed files with 1057 additions and 16 deletions

16
utils/date_convertor.py Normal file
View File

@@ -0,0 +1,16 @@
from datetime import datetime
def convert_date_to_dd_mm_yyyy(date_str):
if isinstance(date_str, datetime.date):
return date_str.strftime("%d-%m-%Y")
# If the input is a string → parse it as YYYY-MM-DD
if isinstance(date_str, str):
try:
dt = datetime.strptime(date_str, "%Y-%m-%d")
return dt.strftime("%d-%m-%Y")
except ValueError:
raise ValueError("String date must be in 'YYYY-MM-DD' format")
# Unsupported type
raise TypeError("Input must be a string or datetime.date object")