Misc minor fixes

This commit is contained in:
Brett Williams
2025-02-28 18:50:44 -06:00
parent cdf4b2bbe1
commit 6b68d42b93
9 changed files with 69 additions and 23 deletions

View File

@@ -210,3 +210,18 @@ def num_to_alphanumeric(num):
result += characters[remainder]
return result[::-1] # Reverse the result to get the correct alphanumeric string
def iso_datestring_to_formatted_datestring(iso_date_string):
from dateutil import parser
import pytz
# Parse the ISO date string into a datetime object and convert timezones
date = parser.isoparse(iso_date_string).astimezone(pytz.UTC)
local_timezone = datetime.now().astimezone().tzinfo
date_local = date.astimezone(local_timezone)
# Format the date to the desired readable yet sortable format with 12-hour time
formatted_date = date_local.strftime('%Y-%m-%d %I:%M %p')
return formatted_date