0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RFC 5545 準拠の iCal ファイルビルダーを作った

0
Posted at

作ったもの

iCal Builderhttps://sen.ltd/portfolio/ical-builder/

スクリーンショット

  • RFC 5545 準拠の ICS 生成
  • 複数イベント対応
  • 繰り返しルール(日次 / 週次 / 月次 / 年次)
  • アラーム(15 分前 / 1 時間前 / 1 日前)
  • 終日イベント
  • 既存 ICS を貼り付けて編集
  • ライブプレビュー

vanilla JS、ゼロ依存、ビルド不要node --test で 38 ケース。

ICS フォーマットの罠

見た目はシンプルな key-value テキストだが、落とし穴が多い:

1. CRLF 必須

\n だけだと厳格なパーサで失敗する。必ず \r\n

2. 75 バイトで折り返し

長い行は \r\n (CRLF + 半角スペース)で折り返す。継続行の先頭スペース込みで 75 バイト予算。

3. テキストエスケープ

.replace(/\\/g, '\\\\')  // バックスラッシュを最初に
.replace(/;/g, '\\;')
.replace(/,/g, '\\,')
.replace(/\n/g, '\\n');

順序が大事。バックスラッシュを最後に置換すると、他のエスケープで入れた \ が二重エスケープされる。

4. DTSTAMP 必須

「イベント作成時刻」として全 VEVENT に必須。忘れるとサイレントに無視される。

5. UID はグローバルにユニーク

同じ UID が複数あると、多くのカレンダーアプリは重複として扱って最後の 1 つだけ取り込む。

シリーズ

100+ 公開ポートフォリオ シリーズの #83 です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?