feat(jornadas): muestra el día de la semana en cada jornada
En la tabla de jornadas del portal del becario y del panel de la supervisora, cada registro muestra el día de la semana (Martes, Sábado, …) derivado de la entrada, en America/Mexico_City. Helper fmtDia en ambos frontends. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
abd81612e1
commit
864af56481
2 files changed
+17
-1
No files matched your search
@@ -40,6 +40,12 @@ function fmtDT(iso) {
|
||||
timeZone: "America/Mexico_City", day: "2-digit", month: "short", hour: "2-digit", minute: "2-digit",
|
||||
});
|
||||
}
|
||||
// Día de la semana (capitalizado) en America/Mexico_City, p.ej. "Martes".
|
||||
function fmtDia(iso) {
|
||||
if (!iso) return "";
|
||||
const d = new Date(iso).toLocaleDateString("es-MX", { timeZone: "America/Mexico_City", weekday: "long" });
|
||||
return d.charAt(0).toUpperCase() + d.slice(1);
|
||||
}
|
||||
const fmtHoras = (h) => `${(h ?? 0).toLocaleString("es-MX", { maximumFractionDigits: 1 })} h`;
|
||||
function localToIso(v) { return v ? new Date(v).toISOString() : null; }
|
||||
|
||||
@@ -254,6 +260,7 @@ function Portal({ session, onSalir }) {
|
||||
{jornadas.slice(0, 20).map((j, i, arr) => (
|
||||
<div key={j.id} style={{ display: "flex", justifyContent: "space-between", alignItems: "center", padding: "12px 15px", borderBottom: i < arr.length - 1 ? `1px solid ${palette.line}` : "none" }}>
|
||||
<div style={{ minWidth: 0, marginRight: "10px" }}>
|
||||
<div style={{ fontFamily: fonts.body, fontWeight: 700, fontSize: "12px", color: palette.brand }}>{fmtDia(j.entrada_ts)}</div>
|
||||
<div style={{ fontFamily: fonts.body, fontWeight: 500, fontSize: "13px", color: palette.ink }}>
|
||||
{fmtDT(j.entrada_ts)} → {j.salida_ts ? fmtDT(j.salida_ts) : "sin salida"}
|
||||
</div>
|
||||
|
||||
+10
-1
@@ -44,6 +44,12 @@ function fmtDT(iso) {
|
||||
year: "numeric", hour: "2-digit", minute: "2-digit",
|
||||
});
|
||||
}
|
||||
// Día de la semana (capitalizado) en America/Mexico_City, p.ej. "Martes".
|
||||
function fmtDia(iso) {
|
||||
if (!iso) return "";
|
||||
const d = new Date(iso).toLocaleDateString("es-MX", { timeZone: "America/Mexico_City", weekday: "long" });
|
||||
return d.charAt(0).toUpperCase() + d.slice(1);
|
||||
}
|
||||
function fmtHoras(h) { return `${(h ?? 0).toLocaleString("es-MX", { maximumFractionDigits: 1 })} h`; }
|
||||
// ISO(UTC) ↔ valor de <input type="datetime-local"> (zona local del navegador)
|
||||
function isoToLocal(iso) {
|
||||
@@ -393,7 +399,10 @@ function VistaBecario({ becarioId, onBack, onError }) {
|
||||
<Table head={["Entrada", "Salida", "Concepto", "Duración", "Acumulado", "Estado", ""]} minWidth={880}>
|
||||
{jornadas.map((j) => (
|
||||
<Tr key={j.id}>
|
||||
<Td nowrap>{fmtDT(j.entrada_ts)}</Td>
|
||||
<Td nowrap>
|
||||
<div style={{ fontFamily: fonts.body, fontWeight: 700, fontSize: "12px", color: palette.brand }}>{fmtDia(j.entrada_ts)}</div>
|
||||
{fmtDT(j.entrada_ts)}
|
||||
</Td>
|
||||
<Td nowrap soft={!j.salida_ts}>{fmtDT(j.salida_ts)}</Td>
|
||||
<Td ellipsis soft={!j.concepto} title={j.concepto || ""}>{j.concepto || "—"}</Td>
|
||||
<Td nowrap soft={j.duracion_minutos == null}>{j.duracion_minutos != null ? `${(j.duracion_minutos / 60).toFixed(1)} h` : "—"}</Td>
|
||||
|
||||
Reference in new issue
Block a user