Agrupar las tarjetas de CaMa y elegir el periodo en Trazabilidad
This commit is contained in:
@@ -23,6 +23,13 @@ export function periods(type: PeriodType, years = 6, today = new Date()): string
|
||||
return found;
|
||||
}
|
||||
|
||||
/** Historical periods ending in the selected month or semester, oldest first. */
|
||||
export function historyPeriods(type: PeriodType, selected: string): string[] {
|
||||
const [year, part] = selected.split('-');
|
||||
const month = type === 'semester' ? (part === 'S1' ? 0 : 6) : Number(part) - 1;
|
||||
return periods(type, 6, new Date(Number(year), month, 1)).reverse();
|
||||
}
|
||||
|
||||
export function periodLabel(period: string): string {
|
||||
const [year, part] = period.split('-');
|
||||
if (part.startsWith('S')) return `${part === 'S1' ? 'Ene–Jun' : 'Jul–Dic'} ${year}`;
|
||||
|
||||
Reference in New Issue
Block a user