npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

unischedule-ics

v0.1.2

Published

A focused JavaScript library for converting university course schedules into .ics calendar files

Readme

unischedule-ics

A focused JavaScript library for converting university course schedules into .ics calendar files. Designed for academic use cases, including lectures, labs, and tutorials with recurring weekly patterns.

Features

  • TypeScript Support: Full TypeScript support with strict type checking
  • Weekly Recurrence: Supports weekly recurring events with RRULE
  • Break Periods: Automatically excludes break periods using EXDATE
  • Multiple Event Types: Handles lectures, labs, tutorials, and other event types
  • Calendar Compatibility: Compatible with Google Calendar, Apple Calendar, and Microsoft Outlook
  • Cross-Environment: Works in both frontend and backend JavaScript/TypeScript environments

Installation

npm install unischedule-ics

Quick Start

import { convertToIcs } from 'unischedule-ics';

const papers = [
  {
    code: 'CS101',
    title: 'Introduction to Computer Science',
    startDate: '2025-02-01',
    endDate: '2025-06-30',
    breaks: [
      {
        title: 'Mid-semester Break',
        startDate: '2025-04-01',
        endDate: '2025-04-07'
      }
    ],
    memo: 'Fundamental concepts of programming',
    events: [
      {
        title: 'Lecture',
        weekday: 1, // Monday
        startTime: '09:00',
        endTime: '10:30',
        location: 'Room A101'
      },
      {
        title: 'Lab',
        weekday: 3, // Wednesday
        startTime: '14:00',
        endTime: '16:00',
        location: 'Computer Lab B'
      }
    ]
  }
];

const icsData = convertToIcs(papers);
console.log(icsData);

Data Structure

Paper Interface

interface Paper {
  code: string;                    // Course code (e.g., "CS101")
  title: string;                   // Course title
  startDate: string;               // Course start date (YYYY-MM-DD format)
  endDate: string;                 // Course end date (YYYY-MM-DD format)
  breaks: PaperBreak[];            // Array of break periods
  memo?: string;                   // Optional course description
  events: PaperEvent[];            // Array of recurring events
}

PaperEvent Interface

interface PaperEvent {
  title: string;                   // Event title (e.g., "Lecture", "Lab")
  weekday: number;                 // Day of week (1-7, Monday to Sunday)
  startTime: string;               // Start time in HH:MM format (e.g., "09:00")
  endTime: string;                 // End time in HH:MM format (e.g., "10:30")
  location: string;                // Event location
}

PaperBreak Interface

interface PaperBreak {
  title: string;                   // Break title (e.g., "Mid-semester Break")
  startDate: string;               // Break start date (YYYY-MM-DD format)
  endDate: string;                 // Break end date (YYYY-MM-DD format)
}

API Reference

Main Function

convertToIcs(papers: Paper[]): string

Converts an array of paper objects into an ICS calendar string.

Parameters:

  • papers: Array of Paper objects containing course information

Returns:

  • ICS formatted string ready for importing into calendar applications

Usage Examples

Basic Usage

import { convertToIcs } from 'unischedule-ics';

const papers = [
  {
    code: 'MATH201',
    title: 'Calculus II',
    startDate: '2025-02-01',
    endDate: '2025-06-30',
    breaks: [],
    events: [
      {
        title: 'Lecture',
        weekday: 2, // Tuesday
        startTime: '11:00',
        endTime: '12:30',
        location: 'Lecture Hall C'
      }
    ]
  }
];

const icsString = convertToIcs(papers);

With Break Periods

const papers = [
  {
    code: 'PHYS301',
    title: 'Quantum Mechanics',
    startDate: '2025-02-01',
    endDate: '2025-06-30',
    breaks: [
      {
        title: 'Mid-semester Break',
        startDate: '2025-04-01',
        endDate: '2025-04-07'
      },
      {
        title: 'Easter Break',
        startDate: '2025-04-17',
        endDate: '2025-04-21'
      }
    ],
    memo: 'Advanced quantum theory course',
    events: [
      {
        title: 'Lecture',
        weekday: 1, // Monday
        startTime: '13:00',
        endTime: '14:30',
        location: 'Physics Building Room 301'
      },
      {
        title: 'Lab',
        weekday: 3, // Wednesday
        startTime: '09:00',
        endTime: '12:00',
        location: 'Physics Lab 2'
      }
    ]
  }
];

const icsString = convertToIcs(papers);

Save to File (Node.js)

import { convertToIcs } from 'unischedule-ics';
import { writeFileSync } from 'fs';

const papers = [...]; // Your paper data

const icsData = convertToIcs(papers);
writeFileSync('university-schedule.ics', icsData);

Download in Browser

import { convertToIcs } from 'unischedule-ics';

const papers = [...]; // Your paper data

const icsData = convertToIcs(papers);
const blob = new Blob([icsData], { type: 'text/calendar' });
const url = URL.createObjectURL(blob);

const a = document.createElement('a');
a.href = url;
a.download = 'university-schedule.ics';
a.click();

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Development mode (watch)
npm run dev

Testing

Comprehensive test coverage including:

  • Date and time parsing
  • Event creation and formatting
  • Recurrence rule generation
  • Exception date handling
  • Edge cases and error handling
npm test

License

MIT