CourseKitStarPlan
Study Blocks
Configurable daily grid of named time windows that lectures align to (HFU defaults included)
StarPlan-driven institutions use a fixed daily grid of "study blocks" — named time windows that all lectures align to. CourseKit's StarPlan package ships HFU's six-block grid as the default and exposes a configuration type so other institutions can supply their own.
HFU defaults
import { HFU_STUDY_BLOCKS, HFU_STUDY_BLOCK_CONFIG } from '@hfu.digital/coursekit-starplan';| Block | Time |
|---|---|
| 1 | 08:00 – 09:30 |
| 2 | 09:45 – 11:15 |
| 3 | 11:30 – 13:00 |
| 4 | 14:00 – 15:30 |
| 5 | 15:45 – 17:15 |
| 6 | 17:30 – 19:00 |
HFU_STUDY_BLOCKS is the array; HFU_STUDY_BLOCK_CONFIG wraps it as { blocks: HFU_STUDY_BLOCKS }.
Custom configuration
import type { StudyBlock, StudyBlockConfig } from '@hfu.digital/coursekit-starplan';
const myInstitutionBlocks: StudyBlockConfig = {
blocks: [
{ block: 1, start: '09:00', end: '10:30' },
{ block: 2, start: '10:45', end: '12:15' },
{ block: 3, start: '13:30', end: '15:00' },
{ block: 4, start: '15:15', end: '16:45' },
],
};
// Pass to parseIcal, getStudyBlockFromTime, etc.
const events = parseIcal(ical, { studyBlocks: myInstitutionBlocks });Types
interface StudyBlock {
block: number; // 1-based block number
start: string; // 'HH:mm' local time
end: string; // 'HH:mm' local time
}
interface StudyBlockConfig {
blocks: StudyBlock[];
}Helpers
import {
getStudyBlockFromTime,
getStudyBlockTimeRange,
} from '@hfu.digital/coursekit-starplan';getStudyBlockFromTime(date, config?)
Resolves which study block a local-time Date falls into. Returns the 1-based block number, or null if the time precedes the first block or follows the last.
getStudyBlockFromTime(new Date('2026-04-13T09:45:00')); // → 2
getStudyBlockFromTime(new Date('2026-04-13T07:30:00')); // → nullEdge behavior:
- Block edges are inclusive on
startand exclusive onend. - Times in the gap between two blocks (e.g. HFU 09:30–09:45) snap forward to the next block.
getStudyBlockTimeRange(blockNumber, config?)
Returns the { start, end } strings for a given block number, or null if the block doesn't exist in the config.
When to use
- During parsing — already wired into
parseIcalvia thestudyBlocksoption. - When rendering a per-day timetable grid in the frontend — align your column edges to the configured blocks.
- When generating the cross-package canonical Study Blocks reference (the same six rows are documented in the root
CLAUDE.md).