INNER CODE UNIT · Python

format_month_day

GHJJ123/brainrotguard · i18n/__init__.py:147

def format_month_day(date_str: str, locale: str | None) -> str:
    """Format YYYY-MM-DD as a short month/day label."""
    dt = datetime.strptime(date_str, "%Y-%m-%d")
    if normalize_locale(locale) == "nb":
        return f"{NB_MONTHS_SHORT[dt.month - 1]} {dt.day:02d}"
    return dt.strftime("%b %d")


def html_lang(locale: str | None) -> str:
    """Return HTML lang attribute value."""
    return normalize_locale(locale)


__all__ = [
    "app_name",
    "DEFAULT_LOCALE",
    "DEFAULT_TIME_FORMAT",
    "SUPPORTED_LOCALES",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…