{"id":13812641,"url":"https://github.com/batoulapps/adhan-js","last_synced_at":"2026-01-02T17:15:20.821Z","repository":{"id":37602646,"uuid":"148370774","full_name":"batoulapps/adhan-js","owner":"batoulapps","description":"High precision Islamic prayer time library for JavaScript","archived":false,"fork":false,"pushed_at":"2025-02-14T19:55:23.000Z","size":6120,"stargazers_count":419,"open_issues_count":3,"forks_count":91,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-19T09:04:22.942Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/batoulapps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-11T19:41:34.000Z","updated_at":"2025-04-16T21:36:28.000Z","dependencies_parsed_at":"2024-11-19T22:46:43.254Z","dependency_job_id":null,"html_url":"https://github.com/batoulapps/adhan-js","commit_stats":{"total_commits":302,"total_committers":23,"mean_commits":"13.130434782608695","dds":0.6390728476821192,"last_synced_commit":"55bad91fcdbbc479bc94c9bd4eab6a04b81712f7"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batoulapps%2Fadhan-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batoulapps%2Fadhan-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batoulapps%2Fadhan-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/batoulapps%2Fadhan-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/batoulapps","download_url":"https://codeload.github.com/batoulapps/adhan-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254239455,"owners_count":22037713,"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":[],"created_at":"2024-08-04T04:00:54.031Z","updated_at":"2026-01-02T17:15:20.792Z","avatar_url":"https://github.com/batoulapps.png","language":"TypeScript","funding_links":[],"categories":["Libraries \u0026 Plugins","Prayer Times Calculation and Display (73 projects)"],"sub_categories":["Javascript","TypeScript"],"readme":"# Adhan JavaScript\n\n[![badge-version][]][npm] [![badge-travis][]][travis] [![badge-cov][]][codecov] [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nAdhan JavaScript is a well tested and well documented library for calculating Islamic prayer times in JavaScript using Node or a web browser.\n\nAll astronomical calculations are high precision equations directly from the book [“Astronomical Algorithms” by Jean Meeus](http://www.willbell.com/math/mc1.htm). This book is recommended by the Astronomical Applications Department of the U.S. Naval Observatory and the Earth System Research Laboratory of the National Oceanic and Atmospheric Administration.\n\nImplementations of Adhan in other languages can be found in the parent repo [Adhan](https://github.com/batoulapps/Adhan).\n\n## Installation\n\nAdhan was designed to work in both the browser and NodeJS applications.\n\n### Browser\n\nWe provide both ESM and UMD bundles for use in the browser.\n\nDownload the latest release and check under `package/lib/bundles`.\n\n```html\n\u003cscript src=\"adhan.umd.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  var prayerTimes = new adhan.PrayerTimes(coordinates, date, params);\n\u003c/script\u003e\n```\n\n### Node\n\nBoth CommonJS and ES Module libraries are provided.\n\n```\nnpm install adhan\n```\n\nCommonJS:\n\n```js\nconst adhan = require('adhan');\nconst prayerTimes = new adhan.PrayerTimes(coordinates, date, params);\n```\n\nES Modules:\n\n```js\nimport { Coordinates, CalculationMethod, PrayerTimes } from 'adhan';\nconst coordinates = new Coordinates(35.7897507, -78.6912485);\nconst params = CalculationMethod.MoonsightingCommittee();\nconst date = new Date(2022, 3, 20);\nconst prayerTimes = new PrayerTimes(coordinates, date, params);\n```\n\n## Migration\n\nMigrating from version 3.x? Read the [migration guide](MIGRATION.md)\n\n## Usage\n\nTo get prayer times initialize a new `PrayerTimes` object passing in coordinates,\ndate, and calculation parameters.\n\n```js\nconst prayerTimes = new PrayerTimes(coordinates, date, params);\n```\n\n### Initialization parameters\n\n#### Coordinates\n\nCreate a `Coordinates` object with the latitude and longitude for the location\nyou want prayer times for.\n\n```js\nconst coordinates = new Coordinates(35.78056, -78.6389);\n```\n\n#### Date\n\nThe date parameter passed in should be an instance of the JavaScript `Date`\nobject. The year, month, and day values need to be populated. All other\nvalues will be ignored. The year, month and day values should be for the date\nthat you want prayer times for. These date values are expected to be for the\nGregorian calendar.\n\n```js\nconst date = new Date();\nconst date = new Date(2015, 11, 1);\n```\n\n#### Calculation parameters\n\nThe rest of the needed information is contained within the `CalculationParameters` object.\n\n[Calculation Parameters \u0026 Methods Guide](METHODS.md)\n\n### Prayer Times\n\nOnce the `PrayerTimes` object has been initialized it will contain values\nfor all five prayer times and the time for sunrise. The prayer times will be\nDate object instances initialized with UTC values. You will then need to format\nthe times for the correct timezone. You can do that by using a timezone aware\ndate formatting library like [moment](https://momentjs.com/docs/).\n\n```js\nmoment(prayerTimes.fajr).tz('America/New_York').format('h:mm A');\n```\n\n### Full Example\n\n```ts\nimport {\n  Coordinates,\n  CalculationMethod,\n  PrayerTimes,\n  SunnahTimes,\n  Prayer,\n  Qibla,\n} from 'adhan';\nimport moment from 'moment-timezone';\n\nconst coordinates = new Coordinates(35.7897507, -78.6912485);\nconst params = CalculationMethod.MoonsightingCommittee();\nconst date = new Date();\nconst prayerTimes = new PrayerTimes(coordinates, date, params);\nconst sunnahTimes = new SunnahTimes(prayerTimes);\n```\n\n[![Edit Adhan Example](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/adhan-example-88v549?fontsize=14\u0026hidenavigation=1\u0026theme=dark)\n\n### Convenience Utilities\n\nThe `PrayerTimes` object has functions for getting the current prayer and the next prayer. You can also get the time for a specified prayer, making it\neasier to dynamically show countdowns until the next prayer.\n\n```js\nvar prayerTimes = new PrayerTimes(coordinates, date, params);\n\nvar current = prayerTimes.currentPrayer();\nvar next = prayerTimes.nextPrayer();\nvar nextPrayerTime = prayerTimes.timeForPrayer(next);\n```\n\n### Sunnah Times\n\nThe Adhan library can also calulate Sunnah times. Given an instance of `PrayerTimes`, you can get a `SunnahTimes` object with the times for Qiyam.\n\n```js\nvar sunnahTimes = new SunnahTimes(prayerTimes);\nvar middleOfTheNight = moment(sunnahTimes.middleOfTheNight)\n  .tz('America/New_York')\n  .format('h:mm A');\nvar lastThirdOfTheNight = moment(sunnahTimes.lastThirdOfTheNight)\n  .tz('America/New_York')\n  .format('h:mm A');\n```\n\n### Qibla Direction\n\nGet the direction, in degrees from North, of the Qibla from a given set of coordinates.\n\n```js\nvar coordinates = new Coordinates(35.78056, -78.6389);\nvar qiblaDirection = Qibla(coordinates);\n```\n\n## Contributing\n\nAdhan is made publicly available to provide a well tested and well documented library for Islamic prayer times to all\ndevelopers. We accept feature contributions provided that they are properly documented and include the appropriate\nunit tests. We are also looking for contributions in the form of unit tests of of prayer times for different\nlocations, we do ask that the source of the comparison values be properly documented.\n\n**Note:** Commit messages should follow the [commit message convention](./.github/COMMIT_CONVENTIONS.md) so that changelogs can be automatically generated. Commit messages will be automatically validated upon commit. **If you are not familiar with the commit message convention, you should use `npm run commit` instead of `git commit`**, which provides an interactive CLI for generating proper commit messages.\n\n## License\n\nAdhan is available under the MIT license. See the LICENSE file for more info.\n\n[badge-version]: https://img.shields.io/npm/v/adhan.svg\n[badge-travis]: https://travis-ci.org/batoulapps/adhan-js.svg?branch=master\n[badge-cov]: https://codecov.io/gh/batoulapps/adhan-js/branch/master/graph/badge.svg\n[travis]: https://travis-ci.org/batoulapps/adhan-js\n[npm]: https://www.npmjs.org/package/adhan\n[codecov]: https://codecov.io/gh/batoulapps/adhan-js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatoulapps%2Fadhan-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbatoulapps%2Fadhan-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbatoulapps%2Fadhan-js/lists"}