Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 5x 5x 5x 5x 5x 5x | /**
* @module mcp-client/riksmote/helpers
* @description Riksmöte (Swedish parliamentary year) helpers.
*
* @author Hack23 AB
* @license Apache-2.0
*/
/**
* Compute the immediately preceding riksmöte label from `YYYY/YY` input.
*
* Returns `null` when the input is not a valid riksmöte token.
*/
export function previousRiksmote(rm: string): string | null {
const match = /^(\d{4})\/(\d{2})$/.exec(rm.trim());
Iif (!match) return null;
const startYear = Number.parseInt(match[1], 10) - 1;
const endYear = Number.parseInt(match[1], 10);
Iif (!Number.isFinite(startYear) || !Number.isFinite(endYear)) return null;
return `${startYear}/${String(endYear).slice(-2)}`;
}
|