Skip to content

mohdsabahat/prayer-times

Repository files navigation

Release License Github Version codecov

Prayer Times Calculator

Based on PrayTimes.js: Prayer Times Calculator (ver 2.3)

Future Plans

In future major versions, this library will undergo a significant refactor to enhance usability and performance. The planned improvements include:

  • Documentation for v1 [In Progress]
  • Modernized codebase with better TypeScript support
  • Improved API design for easier integration
  • Enhanced documentation and examples
  • Additional features and customization options

Stay tuned for updates and new releases!

Overview

PrayTimes.js is originally a JavaScript library for calculating Islamic prayer times. It is developed by Hamid Zarrabi-Zadeh and is distributed under the GNU LGPL v3.0 license.

This Typescript port by mohdsabahat

Features

  • Calculate prayer times for any location
  • Support for different calculation methods
  • Adjustable calculation parameters
  • Tune times by given offsets

Installation

To use PrayerTimes in your project, include the library in your HTML file:

<script src="path/to/build.js"></script>

Usage

Basic Usage

let PT = new PrayerUtils.PrayerTimes('Karachi');
var times = PT.getTimes(new Date(), [43, -80], -5);
console.log('Sunrise = ' + times.sunrise);

Methods

  • getTimes(date, coordinates [, timeZone [, dst [, timeFormat]]])
  • setMethod(method) - Set calculation method
  • adjust(parameters) - Adjust calculation parameters
  • tune(offsets) - Tune times by given offsets
  • getMethod() - Get calculation method
  • getSetting() - Get current calculation parameters
  • getOffsets() - Get current time offsets
  • adjustAsrMethod() - Adjust Asr calculation method, accepted values ['Standard', 'Hanafi']

Documentation

For detailed documentation, please refer to the User's Manual and Calculation Formulas.

License

PrayTimes.js is licensed under the GNU LGPL v3.0. For more information, please refer to the license terms.

PrayTimes.js: Prayer Times Calculator (ver 2.3)
Copyright (C) 2007-2011 PrayTimes.org

Developer: Hamid Zarrabi-Zadeh
License: GNU LGPL v3.0

TERMS OF USE:
    Permission is granted to use this code, with or
    without modification, in any website or application
    provided that credit is given to the original work
    with a link back to PrayTimes.org.

This program is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY.

PLEASE DO NOT REMOVE THIS COPYRIGHT BLOCK.

About

A line to line typescript port of prayerTimes.js library

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •