`;
tbody.appendChild(tr);
});
}
function filterCities(q) {
const needle = q.trim().toLowerCase();
$$(‘#tbody-villes tr’).forEach(tr => {
tr.style.display = (!needle || tr.dataset.label.includes(needle)) ? ” : ‘none’;
});
}
async function loadAllCities(dateStr, onProgress) {
const results = {};
let done = 0;
const total = VILLES_MAROC.length;
const limit = 8; // concurrency limit for performance
const queue = VILLES_MAROC.map(v => v);
async function worker() {
while (queue.length) {
const v = queue.shift();
try {
const t = await fetchTimings(v.city, dateStr);
results[v.label] = t;
} catch {
results[v.label] = { Fajr: ‘—’, Sunrise: ‘—’, Dhuhr: ‘—’, Asr: ‘—’, Maghrib: ‘—’, Isha: ‘—’ };
} finally {
done++;
onProgress(Math.round((done / total) * 100));
}
}
}
await Promise.all(Array.from({ length: limit }, worker));
return results;
}
function renderAllCitiesTable(results) {
$$(‘#tbody-villes tr’).forEach(tr => {
const label = tr.querySelector(‘td strong’).textContent;
const times = results[label];
if (!times) return;
[‘Fajr’,’Sunrise’,’Dhuhr’,’Asr’,’Maghrib’,’Isha’].forEach(k => {
const td = tr.querySelector(`td[data-k=”${k}”]`);
if (td) td.textContent = times[k] || ‘—’;
});
});
}
/* ===============================
UI Initialization
=============================== */
function initUI() {
// Fill city select
const select = $(‘#select-ville’);
VILLES_MAROC.forEach((v, i) => {
const opt = document.createElement(‘option’);
opt.value = v.city;
opt.textContent = v.label;
if (v.label === ‘Casablanca’) opt.selected = true;
select.appendChild(opt);
});
// Default today date (YYYY-MM-DD)
const today = new Date();
const yyyy = today.getFullYear();
const mm = String(today.getMonth() + 1).padStart(2, ‘0’);
const dd = String(today.getDate()).padStart(2, ‘0’);
$(‘#input-date’).value = `${yyyy}-${mm}-${dd}`;
// Initialize table
initAllCitiesRows();
// Listeners
$(‘#btn-actualiser’).addEventListener(‘click’, updateMainCard);
$(‘#select-ville’).addEventListener(‘change’, updateMainCard);
$(‘#input-date’).addEventListener(‘change’, () => {
updateMainCard();
// If user reloads all cities after date change, it will be taken into account
});
$(‘#filtre-ville’).addEventListener(‘input’, (e) => filterCities(e.target.value));
const progressBar = $(‘#progress-bar’);
const srProgress = $(‘#sr-progress’);
function setProgress(pct) {
progressBar.style.width = `${pct}%`;
srProgress.textContent = `Progress ${pct}%`;
}
$(‘#btn-charger-toutes’).addEventListener(‘click’, async () => {
const date = $(‘#input-date’).value ? fromInputDate($(‘#input-date’).value) : new Date();
const dateStr = toDDMMYYYY(date);
setProgress(0);
$(‘#btn-charger-toutes’).setAttribute(‘disabled’, ‘true’);
try {
const results = await loadAllCities(dateStr, setProgress);
renderAllCitiesTable(results);
} catch (e) {
alert(‘Error loading timings for all cities.’);
} finally {
$(‘#btn-charger-toutes’).removeAttribute(‘disabled’);
setProgress(100);
setTimeout(() => setProgress(0), 800);
}
});
// Initial render (Casablanca)
updateMainCard();
}
document.addEventListener(‘DOMContentLoaded’, initUI);
Prayer times in Rabat: daily tables and real-time details
In Rabat, consulting precise prayer times is achieved through a continuously updated service, ensuring reliability and accessibility for the widest audience. The indicated times (Fajr: 05:17, Sunrise: 06:38, Dhuhr: 13:37, Asr: 17:12, Maghrib: 20:28, Isha: 21:48) are based on the Muslim World League and the Shafi’i method for Asr, allowing conformity with the city’s practices.
Automatic time updates
Precision adapted to daily needs
Precise prayer times today in Rabat: Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha
For this day, each prayer is detailed down to the minute. A concrete example: the Asr prayer is at 17:12, while Maghrib occurs at sunset at 20:28.
Notification of the upcoming prayer
Corresponding Hijri date provided: 1446-10-28
The proposed times simplify daily organization and honor the spiritual dimension.
Calculation methods of timings in Rabat: Muslim World League and Asr Shafi’i method
Adoption of the Muslim World League ensures a recognized frame throughout Morocco, adapted to the specificity of Rabat. For Asr, the Shafi’i method guarantees respect for interpretative differences. This methodical choice strengthens the confidence of believers, who benefit from:
An official framework applied locally
Easy adaptation to each urban situation
This technical approach precisely meets the community’s expectations.
Consultation of the next prayer and real-time display of the Hijri date
Thanks to a dynamic interface, the time of the next prayer is always highlighted. For example, if Maghrib is approaching, the tool anticipates and informs about the remaining time. The conversion from the Gregorian calendar to the Hijri enriches the experience, strengthening the cultural link. At any moment, the user can verify:
The prayer not to miss
Precise knowledge of the date according to both calendars
This functionality facilitates organization on all days.
Variation of prayer times over 30 days in Rabat: evolution, accuracy, and national coverage
Timings evolve over the seasons, requiring attentive monitoring. A believer like Samir, an employee at the Rabat administration, uses these services to adapt professional rhythm and religious obligations.
Simple tracking of timing progression
Facilitated forecasting of prayer times over several days
The national dimension ensures coherence for each region.
Progression of timings over 30 days: understanding variations for each prayer
In spring, for example, Fajr gradually shifts, impacting the wake-up time. Observing this progression is essential to anticipate and maintain prayer regularity, even when moving around the city.
Gregorian/Hijri calendar conversion: enriching understanding of prayer times
The correspondence between the two calendars adds value, especially during religious holidays or traditional events in Rabat. This conversion allows better planning of spiritual and family schedules.
Prayer times for all cities in Morocco: reliability and reference for Rabat and the country
Finally, the service offers access to timings for all cities in the territory, with the same accuracy as for Rabat. This national coverage acts as a reference, strengthening the trust and cohesion of practitioners throughout Morocco.