-
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
expose sunset in prayerTimes #107
Conversation
Adhan.d.ts
Outdated
@@ -134,6 +136,7 @@ export enum Prayer { | |||
Sunrise, | |||
Dhuhr, | |||
Asr, | |||
Sunset, |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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.
src/PrayerTimes.js
Outdated
@@ -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); |
There was a problem hiding this comment.
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?
src/PrayerTimes.js
Outdated
@@ -144,6 +146,9 @@ export default class PrayerTimes { | |||
else if (prayer === Prayer.Asr) { | |||
return this.asr; | |||
} | |||
else if (prayer === Prayer.Sunset) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
src/PrayerTimes.js
Outdated
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); |
There was a problem hiding this comment.
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.
src/PrayerTimes.js
Outdated
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
src/PrayerTimes.js
Outdated
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
src/PrayerTimes.js
Outdated
return Prayer.Maghrib; | ||
} | ||
else if (date >= this.asr && this.sunset !== this.maghrib) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
This reverts commit 9d0bf0f.
is it okay now ? |
This pull requests needs to be against the develop branch, which is in typescript instead of javascript. |
closes #105
since it was remained open, I thought maybe create a pull request