Z28912

{
    "Z1K1": "Z2",
    "Z2K1": {
        "Z1K1": "Z6",
        "Z6K1": "Z28912"
    },
    "Z2K2": {
        "Z1K1": "Z14",
        "Z14K1": "Z28911",
        "Z14K3": {
            "Z1K1": "Z16",
            "Z16K1": "Z610",
            "Z16K2": "def Z28911(Z28911K1):\n    \"\"\"\n    Converts a Gregorian date object to a Hijri date object\n\n    Parameters:\n    Z28911K1 (object): A Gregorian Date object with keys \"K1\", \"K2\", \"K3\" for year, month, and day.\n\n    Returns:\n    object: A properly structured Hijri Date object which can be rendered with multilingual month names.\n    \"\"\"\n\n    gregorian_year = Z28911K1[\"K1\"]\n    gregorian_month = Z28911K1[\"K2\"]\n    gregorian_day = Z28911K1[\"K3\"]\n    \n    def is_gregorian_leap(year):\n        return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)\n\n    def total_gregorian_days(year, month, day):\n        \"\"\"Calculates the total number of days since Gregorian epoch 1/1/1.\"\"\"\n        total_days = 0\n        for y in range(1, year):\n            total_days += 366 if is_gregorian_leap(y) else 365\n        \n        days_in_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]\n        if is_gregorian_leap(year):\n            days_in_month[2] = 29\n        \n        total_days += sum(days_in_month[:month]) + day\n        return total_days\n\n    anchor_gregorian_year, anchor_gregorian_month, anchor_gregorian_day = 2025, 9, 30\n    anchor_hijri_year, anchor_hijri_month, anchor_hijri_day = 1447, 4, 8\n\n    # --- Core Conversion Logic ---\n    \n    days_for_target_greg = total_gregorian_days(gregorian_year, gregorian_month, gregorian_day)\n    days_for_anchor_greg = total_gregorian_days(anchor_gregorian_year, anchor_gregorian_month, anchor_gregorian_day)\n    day_difference = days_for_target_greg - days_for_anchor_greg\n\n    def days_since_hijri_epoch(year, month, day):\n        completed_years = year - 1\n        num_leap_years = (11 * completed_years + 14) // 30\n        month_days_cumulative = [0, 30, 59, 89, 118, 148, 177, 207, 236, 266, 295, 325]\n        return (completed_years * 354 + num_leap_years + month_days_cumulative[month - 1] + day)\n\n    days_for_anchor_hijri = days_since_hijri_epoch(anchor_hijri_year, anchor_hijri_month, anchor_hijri_day)\n    total_days_target_hijri = days_for_anchor_hijri + day_difference\n\n    def total_days_to_hijri(total_days):\n        if total_days \u003C= 0: return (None, None, None)\n        year = int(((total_days - 1) / 354.3667) + 1)\n        \n        days_at_year_start = days_since_hijri_epoch(year, 1, 1)\n        while days_at_year_start \u003E total_days:\n            year -= 1\n            days_at_year_start = days_since_hijri_epoch(year, 1, 1)\n        while days_since_hijri_epoch(year + 1, 1, 1) \u003C= total_days:\n            year += 1\n            days_at_year_start = days_since_hijri_epoch(year, 1, 1)\n            \n        day_of_year = total_days - days_at_year_start + 1\n        \n        is_leap = (11 * year + 14) % 30 \u003C 11\n        hijri_month_lengths = [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 30 if is_leap else 29]\n        \n        month = 1\n        while day_of_year \u003E hijri_month_lengths[month - 1]:\n            day_of_year -= hijri_month_lengths[month - 1]\n            month += 1\n        return year, month, day_of_year\n\n    h_year, h_month, h_day = total_days_to_hijri(total_days_target_hijri)\n\n    return f\"{h_day:02d}-{h_month:02d}-{h_year}\""
        }
    },
    "Z2K3": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11",
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1001",
                "Z11K2": "دالة تحويل التاريخ الميلادي إلى الهجري، بايثون"
            },
            {
                "Z1K1": "Z11",
                "Z11K1": "Z1002",
                "Z11K2": "Gregorian to Hijri date conversion function, Pytho"
            }
        ]
    },
    "Z2K4": {
        "Z1K1": "Z32",
        "Z32K1": [
            "Z31"
        ]
    },
    "Z2K5": {
        "Z1K1": "Z12",
        "Z12K1": [
            "Z11"
        ]
    }
}