-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export sunsetTime in prayerTimes #105
Comments
@jd1378 is your use case that you want to be able to display both Maghrib and sunset? |
yes |
I don't think it makes sense to add it to |
well its same usecase for maqrib in some places, it ends the prayer time for asr |
But exporting SolarTime would be nice as well, but that would need exporting |
I've already written a helper for myself, but I thought it would be nicer if the lib did it in the first place: import {Coordinates, PolarCircleResolution} from 'adhan';
// @ts-ignore
import {isValidDate} from 'adhan/src/DateUtils';
// @ts-ignore
import {polarCircleResolvedValues} from 'adhan/src/PolarCircleResolution';
// @ts-ignore
import SolarTime from 'adhan/src/SolarTime';
// @ts-ignore
import TimeComponents from 'adhan/src/TimeComponents';
export function getSunset(
date: Date,
coordinates: Coordinates,
polarCircleResolver = PolarCircleResolution.Unresolved,
): Date {
let solarTime = new SolarTime(date, coordinates);
let sunsetTime = new TimeComponents(solarTime.sunset).utcDate(
date.getFullYear(),
date.getMonth(),
date.getDate(),
);
if (
!isValidDate(sunsetTime) &&
polarCircleResolver !== PolarCircleResolution.Unresolved
) {
const resolved = polarCircleResolvedValues(
polarCircleResolver,
date,
coordinates,
);
solarTime = resolved.solarTime;
const dateComponents = [
date.getFullYear(),
date.getMonth(),
date.getDate(),
];
sunsetTime = new TimeComponents(solarTime.sunset).utcDate(
...dateComponents,
);
}
return sunsetTime;
} |
# [4.4.0](v4.3.2...v4.4.0) (2022-05-11) ### Features * **prayertimes:** expose sunset time ([05a0c34](05a0c34)), closes [#105](#105)
🎉 This issue has been resolved in version 4.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi
It would be good if the sunset time was also exported from prayerTimes and in the nextPrayer method
because in some calculation Maqrib prayer time is not same as sunset
The text was updated successfully, but these errors were encountered: