Jump to content

en Gregorian to Bangla in javascript (Bangladesh) Z12950
en Implementation

From Wikifunctions
No edit summary
No edit summary
 
(16 intermediate revisions by 5 users not shown)
Line 10: Line 10:
"Z14K3": {
"Z14K3": {
"Z1K1": "Z16",
"Z1K1": "Z16",
"Z16K1": {
"Z16K1": "Z600",
"Z16K2": "function Z12926(Z12926K1, Z12926K2, Z12926K3) {\r\n const monthName = [\r\n 'Boishakh', 'Joishtho', 'Ashar', 'Shrabon',\r\n 'Bhadro', 'Ashwin', 'Kartik', 'Agrahayan',\r\n 'Poush', 'Magh', 'Falgun', 'Chaitro'\r\n ];\r\n\r\n const gYear = parseInt(Z12926K1);\r\n const gMonth = parseInt(Z12926K2)\r\n const gDay = parseInt(Z12926K3);\r\n\r\n const isLeapYear = (gYear % 4 === 0 \u0026\u0026 gYear % 100 !== 0) || (gYear % 400 === 0);\r\n\r\n let bYear;\r\n if ((gMonth === 3 \u0026\u0026 gDay \u003E= 14) || gMonth \u003E 3) {\r\n bYear = gYear - 593;\r\n } else {\r\n bYear = gYear - 594;\r\n }\r\n\r\n const bMonthArray = [\r\n [8, 9], [9, 10], [10, 11], [11, 0],\r\n [0, 1], [1, 2], [2, 3], [3, 4],\r\n [4, 5], [5, 6], [6, 7], [7, 8]\r\n ];\r\n\r\n const bDateArray = [\r\n [16, -14], [17, -13], [16, -14], [17, -13],\r\n [17, -14], [17, -14], [16, -15], [16, -15],\r\n [16, -15], [15, -16], [15, -15], [15, -15]\r\n ];\r\n\r\n let bMonth, bDate;\r\n if (gDay \u003C= 13) {\r\n bMonth = bMonthArray[gMonth][0];\r\n bDate = gDay + bDateArray[gMonth][0];\r\n } else {\r\n bMonth = bMonthArray[gMonth][1];\r\n bDate = gDay + bDateArray[gMonth][1];\r\n }\r\n\r\n if (isLeapYear \u0026\u0026 bMonth === 11 \u0026\u0026 bDate === 30) {\r\n bDate = 31;\r\n }\r\n\r\n return `${bDate} ${monthName[bMonth]} ${bYear}`;\r\n}"
"Z1K1": "Z61",
"Z61K1": "javascript"
},
"Z16K2": "function Z12926(Z12926K1, Z12926K2, Z12926K3) {\r\n const yearOffset = 594;\r\n\r\n const monthMap = [\r\n 'Boishakh', 'Joishtho', 'Ashar', 'Shrabon',\r\n 'Bhadro', 'Ashwin', 'Kartik', 'Agrahayan',\r\n 'Poush', 'Magh', 'Falgun', 'Chaitro'\r\n ];\r\n\r\n const startDates = [\r\n new Date(594, 2, 14), new Date(594, 3, 14), new Date(594, 4, 14),\r\n new Date(594, 5, 15), new Date(594, 6, 16), new Date(594, 7, 16),\r\n new Date(594, 8, 16), new Date(594, 9, 15), new Date(594, 10, 15),\r\n new Date(594, 11, 15), new Date(595, 0, 14), new Date(595, 1, 13)\r\n ];\r\n\r\n const gYear = Z12926K1;\r\n const gMonth = Z12926K2 - 1;\r\n const gDate = Z12926K3;\r\n\r\n const startDate = startDates[gMonth];\r\n let bYear = gYear - yearOffset + startDate.getFullYear();\r\n const bMonth = monthMap[startDate.getMonth()];\r\n\r\n let bDate = gDate - startDate.getDate() + 1;\r\n\r\n if (bDate \u003C= 0) {\r\n const prevMonth = gMonth === 0 ? 11 : gMonth - 1;\r\n const prevStartDate = startDates[prevMonth];\r\n const daysInPrevMonth = new Date(gYear, gMonth, 0).getDate();\r\n bDate = daysInPrevMonth + bDate; \r\n\r\n if (prevMonth === 11 \u0026\u0026 gMonth === 2) {\r\n bYear--;\r\n }\r\n }\r\n\r\n if (startDate.getMonth() === 0 \u0026\u0026 gMonth === 2 \u0026\u0026 gDate \u003C 14) {\r\n bYear--;\r\n }\r\n\r\n return `${bDate} ${bMonth} ${bYear}`;\r\n}"
}
}
},
},
Line 20: Line 17:
"Z1K1": "Z12",
"Z1K1": "Z12",
"Z12K1": [
"Z12K1": [
"Z11"
"Z11",
{
"Z1K1": "Z11",
"Z11K1": "Z1002",
"Z11K2": "Gregorian to Bangla in javascript (Bangladesh)"
},
{
"Z1K1": "Z11",
"Z11K1": "Z1014",
"Z11K2": "Gregorian ka Bangla, javascipt"
}
]
]
},
},

Latest revision as of 14:37, 5 August 2024

This page displays in a limited way without JavaScript.