Comments (7)
@jd1378 is your use case that you want to be able to display both Maghrib and sunset?
from adhan-js.
yes
from adhan-js.
I don't think it makes sense to add it to nextPrayer
since sunset isn't a prayer. Maghrib is the prayer time. We include sunrise
since thats when the prayer time for Fajr specifically ends. It might make more sense to export SolarTime
instead if you just want times of the sunset itself.
from adhan-js.
well its same usecase for maqrib in some places, it ends the prayer time for asr
from adhan-js.
But exporting SolarTime would be nice as well, but that would need exporting PolarCircleResolution
,TimeComponents
and DateUtils
to do the same thing as the lib is doing
from adhan-js.
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;
}
from adhan-js.
🎉 This issue has been resolved in version 4.4.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from adhan-js.
Related Issues (20)
- Altitude Support HOT 1
- Prayer Ending Times HOT 1
- Understanding the functionality of nextPrayer and currentPrayer HOT 2
- Moon Phases?
- Wrong time returned HOT 1
- [suggestion]: Use `const enums` for some constant variables
- time difference for asr on Turkey HOT 1
- The use of Temporal HOT 2
- [suggestion]: Add 'Imsak' Timings HOT 4
- Host the javascript on cdnjs or similar HOT 1
- Turkish Diyanet times for Netherlands gives wrong for yatsi time
- Reason for using sth like moment.js HOT 2
- Taking elevation into account for prayer times HOT 1
- Considering elevation for Salah times HOT 21
- TypeError: Cannot read properties of undefined (reading 'getTime') HOT 1
- add adjustment settings to sunset HOT 6
- Prayer times are wrong(?) HOT 16
- The possibility of adjusting the midnight time HOT 1
- Calculation is returning prayer times for next day instead of "today" HOT 1
- Getting Default Calculation Method for Location
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adhan-js.