Retro Bulletin Board Systems on atproto. Web app and TUI. atbbs.xyz
python tui atproto bbs
at master 20 lines 564 B view raw
1"""Shared utilities.""" 2 3from datetime import datetime, timezone 4 5 6def now_iso() -> str: 7 """Current UTC timestamp in ISO format.""" 8 return datetime.now(timezone.utc).isoformat() 9 10 11def format_datetime_utc(value: str) -> str: 12 """Format an ISO datetime string as UTC.""" 13 dt = datetime.fromisoformat(value) 14 return dt.strftime("%Y-%m-%d %H:%M UTC") 15 16 17def format_datetime_local(value: str) -> str: 18 """Format an ISO datetime string in local timezone.""" 19 dt = datetime.fromisoformat(value).astimezone() 20 return dt.strftime("%Y-%m-%d %H:%M")