{"id":21145816,"url":"https://github.com/xsoh/hijri.js","last_synced_at":"2025-07-09T07:31:44.129Z","repository":{"id":6872660,"uuid":"8121709","full_name":"xsoh/Hijri.js","owner":"xsoh","description":"A tool for the Islamic calender (Hijri) in Javascript","archived":false,"fork":false,"pushed_at":"2023-01-31T02:50:08.000Z","size":898,"stargazers_count":74,"open_issues_count":4,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-11T14:40:14.040Z","etag":null,"topics":["calendar","gregorian","hijri","hijri-calendar"],"latest_commit_sha":null,"homepage":"http://xsoh.github.com/Hijri.js","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xsoh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-10T11:15:07.000Z","updated_at":"2024-11-08T00:27:00.000Z","dependencies_parsed_at":"2023-02-16T15:00:36.350Z","dependency_job_id":null,"html_url":"https://github.com/xsoh/Hijri.js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsoh%2FHijri.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsoh%2FHijri.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsoh%2FHijri.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsoh%2FHijri.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xsoh","download_url":"https://codeload.github.com/xsoh/Hijri.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492617,"owners_count":17482924,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","gregorian","hijri","hijri-calendar"],"created_at":"2024-11-20T08:44:01.496Z","updated_at":"2024-11-20T08:44:02.096Z","avatar_url":"https://github.com/xsoh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hijri.js\n========\n\nA simple implementation for the Islamic calender(Hijri) in Javascript\n\n## The Problem\nI made this project just because I did not found any correct and open source Hijri converter. Each time I try one its either stored in database and fetch the data each time or it does not give me the correct date \"specially when I try before 1420H\"\n\n## Usage\n### Current Day\nTo get Today in Hijri:\n```html\n\u003cbody onload=\"initWork()\" \u003e\n\t\u003c!-- Include Hijri.js in your work --\u003e\n\t\u003cscript type=\"text/javascript\" src=\"Hijri.js\"\u003e\u003c/script\u003e\n\n\t\u003cspan\u003eToday is: \u003c/span\u003e\u003cspan id=\"today\"\u003e\u003c/span\u003e\n\t\u003cscript type=\"text/javascript\"\u003e\n\tfunction initWork() {\n\t\t//Today\n\t\tvar todayElement = document.getElementById(\"today\");\n\t\ttodayElement.innerHTML = HijriJS.today().toString();\n\t}\n\t\u003c/script\u003e\n\u003c/body\u003e\n```\n### Conversion\nTo convert between Hijri and Gregorian use the ``HijriJS.toHijri(dateString, splitter)`` to convert Gregorian to Hijri \nor ``HijriJS.toGregorian(dateString, splitter)``  to convert Hijri to Gregorian where the splitter is the symbol splits the date (e.g. for 1434/1/1 is ``HijriJS.toGregorian(\"1434/1/1\", \"/\")``):\n```html\n\u003cbody\u003e\n\t\u003c!-- Include Hijri.js in your work --\u003e\n\t\u003cscript type=\"text/javascript\" src=\"Hijri.js\"\u003e\u003c/script\u003e\n\n\t\u003c!-- Input Area --\u003e\n\t\u003cinput id=\"gregorianInput\" onchange=\"convertToHijri()\" /\u003e\n\t\u0026nbsp; \u003cspan id=\"hijriDate\"\u003e\u003c/span\u003e\n\n\t\u003cscript type=\"text/javascript\"\u003e\n\tfunction convertToHijri() {\n\t\tvar gregorianDate = document.getElementById(\"gregorianInput\").value\n\t\tvar hijriDate = document.getElementById(\"hijriDate\");\n\n\t\tvar date = HijriJS.toHijri(gregorianDate, \"/\");\n\t\thijriDate.innerHTML = date.toString();\n\t}\n\t\u003c/script\u003e\n\u003c/body\u003e\n```\n### Formating\nMore advanced is to print the date with different format you can use ``date.toFormat(yourStringFormat);`` where yourStringFormat can be:\n- **YYYY**: For the four digit year notation e.g. 1434.\n- **YY**: For two year notation e.g. 34 of 1434.\n- **mm**: For two digit month notation e.g. 03.\n- **m**: For one digit month notation e.g. 3.\n- **dd**: For two digit day notation.\n- **d**: For one digit day notation.\n- **n**: For calender notation \"H for Hijri or G for Gregorian\".\n\nYou can use the same example above and change it like this:\n```javascript\n\nfunction convertToHijri() {\n\tvar gregorianDate = document.getElementById(\"gregorianInput\").value\n\tvar hijriDate = document.getElementById(\"hijriDate\");\n\n\tvar date = HijriJS.toHijri(gregorianDate, \"/\");\n\thijriDate.innerHTML = date.toFormat(\"dd/mm/yyyyN\");\n}\n\n```\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsoh%2Fhijri.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxsoh%2Fhijri.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsoh%2Fhijri.js/lists"}