add week day + always 2 digits minutes

This commit is contained in:
Allan Cueff
2023-11-04 01:13:18 +01:00
parent 03ac1e204e
commit 10c269d30b
2 changed files with 3 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ function getSportNextMatchText(sport){
return "Pas de match prévu";
}
const time_start = new Date(match.heure_debut);
return "Prochain match : " + match.expand.team1.name + " vs " + match.expand.team2.name + " à " + time_start.getHours() + "h" + time_start.getMinutes();
return "Prochain match : " + match.expand.team1.name + " vs " + match.expand.team2.name + ' ' + time_start.toLocaleString('fr', { weekday: 'long' }) + " à " + time_start.toLocaleString('fr', { hour: 'numeric', minute: 'numeric' });
}
function getSportCard(sport){

View File

@@ -94,7 +94,7 @@ function getPromoCard(promo, teamsList){
const nextMatch = matchList.find(match => match.expand.team1.promo === promo.id || match.expand.team2.promo === promo.id);
if(nextMatch){
const time_start = new Date(nextMatch.heure_debut);
cardHtml += `<div class="card-footer bg-light-subtle text-emphasis-light">Prochain match : ${nextMatch.expand.team1.name} vs ${nextMatch.expand.team2.name} à ${time_start.getHours()}h${time_start.getMinutes()}</div>`
cardHtml += `<div class="card-footer bg-light-subtle text-emphasis-light">Prochain match : ${nextMatch.expand.team1.name} vs ${nextMatch.expand.team2.name} ${time_start.toLocaleString('fr', { weekday: 'long' })} à ${time_start.toLocaleString('fr', { hour: 'numeric', minute: 'numeric' })}</div>`
}
cardHtml += `</div>`
return cardHtml
@@ -136,7 +136,7 @@ function getTeamCard(teamBySport){
const nextMatch = matchList.find(match => match.expand.team1.name === equipe.name || match.expand.team2.name === equipe.name);
if(nextMatch){
const time_start = new Date(nextMatch.heure_debut);
cardHtml += `<div class="card-footer bg-light-subtle text-emphasis-light">Prochain match : ${nextMatch.expand.team1.name} vs ${nextMatch.expand.team2.name} à ${time_start.getHours()}h${time_start.getMinutes()}</div>`
cardHtml += `<div class="card-footer bg-light-subtle text-emphasis-light">Prochain match : ${nextMatch.expand.team1.name} vs ${nextMatch.expand.team2.name} ${time_start.toLocaleString('fr', { weekday: 'long' })} à ${time_start.toLocaleString('fr', { hour: 'numeric', minute: 'numeric' })}</div>`
}
cardHtml += `</div>`
return cardHtml