Skip to content
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

expose sunset in prayerTimes #107

Closed
wants to merge 3 commits into from

Conversation

jd1378
Copy link
Contributor

@jd1378 jd1378 commented May 10, 2022

closes #105
since it was remained open, I thought maybe create a pull request

Adhan.d.ts Outdated
@@ -134,6 +136,7 @@ export enum Prayer {
Sunrise,
Dhuhr,
Asr,
Sunset,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add sunset to the PrayerTimes object but I don't want to change the Prayer enum.

src/Prayer.js Outdated
@@ -3,6 +3,7 @@ const Prayer = {
Sunrise: 'sunrise',
Dhuhr: 'dhuhr',
Asr: 'asr',
Sunset: 'sunset',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed as we are not changing this.

@@ -120,13 +120,15 @@ export default class PrayerTimes {
const sunriseAdjustment = (calculationParameters.adjustments.sunrise || 0) + (calculationParameters.methodAdjustments.sunrise || 0);
const dhuhrAdjustment = (calculationParameters.adjustments.dhuhr || 0) + (calculationParameters.methodAdjustments.dhuhr || 0);
const asrAdjustment = (calculationParameters.adjustments.asr || 0) + (calculationParameters.methodAdjustments.asr || 0);
const sunsetAdjustment = (calculationParameters.adjustments.sunset || 0) + (calculationParameters.methodAdjustments.sunset || 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought the point was to expose the true sunset value, why would we add adjustments?

@@ -144,6 +146,9 @@ export default class PrayerTimes {
else if (prayer === Prayer.Asr) {
return this.asr;
}
else if (prayer === Prayer.Sunset) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

const maghribAdjustment = (calculationParameters.adjustments.maghrib || 0) + (calculationParameters.methodAdjustments.maghrib || 0);
const ishaAdjustment = (calculationParameters.adjustments.isha || 0) + (calculationParameters.methodAdjustments.isha || 0);

this.fajr = roundedMinute(dateByAddingMinutes(fajrTime, fajrAdjustment), calculationParameters.rounding);
this.sunrise = roundedMinute(dateByAddingMinutes(sunriseTime, sunriseAdjustment), calculationParameters.rounding);
this.dhuhr = roundedMinute(dateByAddingMinutes(dhuhrTime, dhuhrAdjustment), calculationParameters.rounding);
this.asr = roundedMinute(dateByAddingMinutes(asrTime, asrAdjustment), calculationParameters.rounding);
this.sunset = roundedMinute(dateByAddingMinutes(sunsetTime, sunsetAdjustment), calculationParameters.rounding);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should remove the call to dateByAddingMinutes and only do the rounding to preserve true sunset time.

@@ -165,6 +170,9 @@ export default class PrayerTimes {
else if (date >= this.maghrib) {
return Prayer.Maghrib;
}
else if (date >= this.sunset && this.sunset !== this.maghrib) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@@ -192,9 +200,12 @@ export default class PrayerTimes {
else if (date >= this.maghrib) {
return Prayer.Isha;
}
else if (date >= this.asr) {
else if (date >= this.sunset) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert

return Prayer.Maghrib;
}
else if (date >= this.asr && this.sunset !== this.maghrib) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@jd1378
Copy link
Contributor Author

jd1378 commented May 11, 2022

is it okay now ?

@jd1378 jd1378 changed the title add sunset to prayers expose sunset in prayerTimes May 11, 2022
@sgtsquiggs sgtsquiggs self-requested a review May 11, 2022 13:38
@sgtsquiggs
Copy link
Contributor

This pull requests needs to be against the develop branch, which is in typescript instead of javascript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Export sunsetTime in prayerTimes
3 participants