Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ts-ics

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-ics

Create and parse ICS format for TypeScript

  • 1.6.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21K
increased by4.83%
Maintainers
0
Weekly downloads
 
Created
Source

TS-ICS

neuvernetzung-logo

NPM

This package can parse and create Ics files and provides TypeScript types for easy handling.

Motivation

Many of the Ics packages provide good functionality, however none of these are type safe. This package can parse Ics strings with Zod. Also, many packages are not actively maintained.

Installation

npm i ts-ics

generate

generateIcsCalendar

import { generateIcsCalendar, type VCalendar } from "ts-ics";

const calendar: VCalendar = {...}

const icsCalendarString = generateIcsCalendar(calendar);

generateIcsEvent

import { generateIcsEvent, type VEvent } from "ts-ics";

const event: VEvent = {...}

const icsEventString = generateIcsEvent(event);

parse

parseIcsCalendar

parse with zod
import { parseIcsCalendar, type VCalendar } from "ts-ics";

const calendarParsed: VCalendar = parseIcsCalendar(icsCalendarString);
without zod parsing
import { icsCalendarToObject, type VCalendar } from "ts-ics";

const calendar: VCalendar = icsCalendarToObject(icsCalendarString);

parseIcsEvent

parse with zod
import { parseIcsEvent, type VEvent } from "ts-ics";

const eventParsed: VEvent = parseIcsEvent(icsEventString);
without zod parsing
import { icsEventToObject, type VEvent } from "ts-ics";

const event: VEvent = icsEventToObject(icsEventString);

utils

extendByRecurrenceRule

import { extendByRecurrenceRule } from "ts-ics";

const start = new Date(Date.UTC(2023, 9, 5));
const ruleString = "FREQ=DAILY;BYMINUTE=15,16,17,18,19;BYSECOND=0,20,40";

const rule = parseIcsRecurrenceRule(ruleString);

const dates = extendByRecurrenceRule(rule, {
  start,
  end: addDays(start, 1),
});

License

MIT - License

Thanks

Thanks to iCalendar.org for the ics documentation and the many examples which are used for testing purposes.

FAQs

Package last updated on 01 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc