prayertiming
Version:
A small library to calculate muslim prayer times based on coordinates and timezone
150 lines (146 loc) • 4.25 kB
TypeScript
declare const CalculationMethods: {
readonly MWL: {
readonly name: "Muslim World League";
readonly params: {
readonly fajr: 18;
readonly isha: 17;
};
};
readonly ISNA: {
readonly name: "Islamic Society of North America (ISNA)";
readonly params: {
readonly fajr: 15;
readonly isha: 15;
};
};
readonly MF: {
readonly name: "Muslims of France (MF)";
readonly params: {
readonly fajr: 12;
readonly isha: 12;
};
};
readonly Egypt: {
readonly name: "Egyptian General Authority of Survey";
readonly params: {
readonly fajr: 19.5;
readonly isha: 17.5;
};
};
readonly Makkah: {
readonly name: "Umm Al-Qura University, Makkah";
readonly params: {
readonly fajr: 18.5;
readonly isha: "90 min";
};
};
readonly Karachi: {
readonly name: "University of Islamic Sciences, Karachi";
readonly params: {
readonly fajr: 18;
readonly isha: 18;
};
};
readonly Tehran: {
readonly name: "Institute of Geophysics, University of Tehran";
readonly params: {
readonly fajr: 17.7;
readonly isha: 14;
readonly maghrib: 4.5;
readonly midnight: "Jafari";
};
};
readonly Jafari: {
readonly name: "Shia Ithna-Ashari, Leva Institute, Qum";
readonly params: {
readonly fajr: 16;
readonly isha: 14;
readonly maghrib: 4;
readonly midnight: "Jafari";
};
};
readonly JAKIM: {
readonly name: "Jabatan Kemajuan Islam Malaysia";
readonly params: {
readonly fajr: 20;
readonly isha: 18;
};
};
readonly MCW: {
readonly name: "Moonsighting Committee Worldwide";
readonly params: {
readonly fajr: 18;
readonly isha: 18;
};
};
};
type CalculationMethod = keyof typeof CalculationMethods;
type FormattedPrayerTimes = {
imsak: number | string;
fajr: number | string;
sunrise: number | string;
dhuhr: number | string;
asr: number | string;
asrHanafi: number | string;
sunset: number | string;
maghrib: number | string;
isha: number | string;
midnight?: number | string;
};
type PrayerTimesResult = FormattedPrayerTimes & {
date: Date;
method: CalculationMethod;
};
declare const MidnightMethods: {
readonly Standard: "Standard";
readonly Jafari: "Jafari";
};
type Midnight = keyof typeof MidnightMethods;
declare const HighLatsMethods: {
readonly AngleBased: "AngleBased";
readonly OneSeventh: "OneSeventh";
readonly NightMiddle: "NightMiddle";
readonly None: "None";
};
type HighLats = keyof typeof HighLatsMethods;
type Settings = {
fajr?: number;
isha?: number | `${number} min`;
imsak?: `${number} min`;
dhuhr?: `${number} min`;
maghrib?: number | `${number} min`;
midnight?: Midnight;
highLats?: HighLats;
};
declare const TimeFormats: {
readonly '24h': "24h";
readonly '12h': "12h";
readonly Float: "Float";
};
type TimeFormat = keyof typeof TimeFormats;
type GetByDayParams = {
long: number;
lat: number;
timezone?: number;
dst?: number;
elv?: number;
date?: Date;
timeFormat?: TimeFormat;
method?: CalculationMethod;
config?: Settings;
};
declare function getByDay({ long, lat, timezone, dst, elv, date, timeFormat, method, config, }: GetByDayParams): PrayerTimesResult;
type GetByMonthParams = {
long: number;
lat: number;
timezone?: number;
dst?: number;
elv?: number;
month?: number;
year?: number;
timeFormat?: TimeFormat;
method?: CalculationMethod;
config?: Settings;
};
declare function getByMonth({ long, lat, timezone, dst, elv, month, year, timeFormat, method, config, }: GetByMonthParams): PrayerTimesResult[];
export { type CalculationMethod, CalculationMethods, type GetByDayParams, type GetByMonthParams, type PrayerTimesResult, type TimeFormat, TimeFormats, getByDay, getByMonth };