MCPcopy Create free account
hub / github.com/dbunt1tled/python-fast-api / _format_date

Method _format_date

src/core/service/email/view_service.py:89–100  ·  view source on GitHub ↗
(date_input: str | datetime, format_str: str = "%d.%m.%Y")

Source from the content-addressed store, hash-verified

87
88 @staticmethod
89 def _format_date(date_input: str | datetime, format_str: str = "%d.%m.%Y") -> str:
90 try:
91 if isinstance(date_input, str):
92 if "T" in date_input:
93 date_obj = datetime.fromisoformat(date_input.replace("Z", "+00:00"))
94 else:
95 date_obj = datetime.strptime(date_input, "%Y-%m-%d")
96 else:
97 date_obj = date_input
98 return date_obj.strftime(format_str)
99 except:
100 return str(date_input)
101
102 @staticmethod
103 def _format_currency(amount: float, currency: str = "$") -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected