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);
|
||||
}
|
||||
|
||||
_dayName(index, style, firstLetter = false) {
|
||||
// 2024-01-01 est un lundi
|
||||
let name = new Date(2024, 0, 1 + index).toLocaleDateString(this._lang(), {
|
||||
_dayName(index, style) {
|
||||
// 2024-01-01 est un lundi ; style "narrow" donne l'initiale (L, M, M, J, V, S, D)
|
||||
const name = new Date(2024, 0, 1 + index).toLocaleDateString(this._lang(), {
|
||||
weekday: style,
|
||||
});
|
||||
if (firstLetter) { name = name.charAt(0); }
|
||||
return capitalize(name.replace(/\.$/, ""));
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +438,7 @@ class ReveilCard extends HTMLElement {
|
|||
return `
|
||||
<div class="day ${active ? "on" : ""} ${override ? "ovr" : ""}">
|
||||
<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}"
|
||||
aria-expanded="${this._editing === day}" aria-label="${esc(L.editTime(long))}">${esc(this._fmt(effective))}</button>
|
||||
</div>`;
|
||||
|
|
|
|||
Loading…
Reference in a new issue