Show only day's first letter
This commit is contained in:
parent
34b9138cff
commit
b88305623f
|
|
@ -294,12 +294,11 @@ class ReveilCard extends HTMLElement {
|
||||||
return date.toLocaleTimeString(this._lang(), opts);
|
return date.toLocaleTimeString(this._lang(), opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
_dayName(index, style, firstLetter = false) {
|
_dayName(index, style) {
|
||||||
// 2024-01-01 est un lundi
|
// 2024-01-01 est un lundi ; style "narrow" donne l'initiale (L, M, M, J, V, S, D)
|
||||||
let name = new Date(2024, 0, 1 + index).toLocaleDateString(this._lang(), {
|
const name = new Date(2024, 0, 1 + index).toLocaleDateString(this._lang(), {
|
||||||
weekday: style,
|
weekday: style,
|
||||||
});
|
});
|
||||||
if (firstLetter) { name = name.charAt(0); }
|
|
||||||
return capitalize(name.replace(/\.$/, ""));
|
return capitalize(name.replace(/\.$/, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,7 +438,7 @@ class ReveilCard extends HTMLElement {
|
||||||
return `
|
return `
|
||||||
<div class="day ${active ? "on" : ""} ${override ? "ovr" : ""}">
|
<div class="day ${active ? "on" : ""} ${override ? "ovr" : ""}">
|
||||||
<button class="chip" data-action="toggle-day" data-day="${day}"
|
<button class="chip" data-action="toggle-day" data-day="${day}"
|
||||||
aria-pressed="${active}" aria-label="${esc(L.toggleDay(long))}">${esc(this._dayName(i, "short", true))}</button>
|
aria-pressed="${active}" aria-label="${esc(L.toggleDay(long))}">${esc(this._dayName(i, "narrow"))}</button>
|
||||||
<button class="hhmm" data-action="edit-time" data-day="${day}"
|
<button class="hhmm" data-action="edit-time" data-day="${day}"
|
||||||
aria-expanded="${this._editing === day}" aria-label="${esc(L.editTime(long))}">${esc(this._fmt(effective))}</button>
|
aria-expanded="${this._editing === day}" aria-label="${esc(L.editTime(long))}">${esc(this._fmt(effective))}</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue