CalendarJS

December 23, 2025 ยท View on GitHub

Lightweight JavaScript components for calendars, schedules, and timelines. Works with React, Vue, Angular, or vanilla JS.

Components

ComponentSizeDescription
Calendar3.2KBDate picker with range and time selection
Schedule4.2KBDay/week event scheduler with drag-and-drop
Timeline2.1KBChronological event display
Helpers1KBDate utilities and formatting

Installation

npm install @calendarjs/ce

Or via CDN:

<script src="https://cdn.jsdelivr.net/npm/lemonadejs/dist/lemonade.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@calendarjs/ce/dist/index.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@calendarjs/ce/dist/style.min.css" />

Quick Start

Calendar

import { Calendar } from '@calendarjs/ce';

Calendar(document.getElementById('calendar'), {
    type: 'inline',
    value: '2025-01-15',
    onchange: (self, value) => console.log(value)
});

Schedule

import { Schedule } from '@calendarjs/ce';

Schedule(document.getElementById('schedule'), {
    type: 'week',
    value: '2025-01-15',
    data: [
        { guid: '1', title: 'Meeting', date: '2025-01-15', start: '09:00', end: '10:00', color: '#3498db' }
    ]
});

Timeline

import { Timeline } from '@calendarjs/ce';

Timeline(document.getElementById('timeline'), {
    data: [
        { title: 'Project Start', date: '2025-01-01', borderColor: '#3498db' },
        { title: 'Launch', date: '2025-03-01', borderColor: '#27ae60' }
    ]
});

React

import { Calendar, Schedule, Timeline } from '@calendarjs/ce/dist/react';
import '@calendarjs/ce/dist/style.css';

function App() {
    return <Calendar type="inline" value="2025-01-15" />;
}

Vue

<template>
    <Calendar type="inline" value="2025-01-15" />
</template>

<script>
import { Calendar } from '@calendarjs/ce/dist/vue';
import '@calendarjs/ce/dist/style.css';

export default {
    components: { Calendar }
}
</script>

Calendar Options

OptionTypeDescription
type'default' | 'inline' | 'picker'Display mode
valuestring | DateSelected date
rangebooleanEnable range selection
timebooleanShow time picker
formatstringDate format (e.g., 'DD/MM/YYYY')
validRangestring[]Restrict selectable dates
onchangefunctionCallback on date change

Schedule Options

OptionTypeDescription
type'day' | 'week' | 'weekdays'View type
valuestringCurrent date (YYYY-MM-DD)
dataEvent[]Array of events
gridnumberTime interval in minutes (default: 15)
validRangestring[]Visible time range (e.g., ['08:00', '18:00'])
weeklybooleanRecurring weekly mode

Event Object

{
    guid: string;        // Unique identifier
    title: string;       // Event title
    date: string;        // YYYY-MM-DD (or weekday 0-6 if weekly: true)
    start: string;       // HH:MM
    end?: string;        // HH:MM
    color: string;       // Hex color
}

Schedule Methods

const schedule = Schedule(element, options);

schedule.addEvents({ guid: '2', title: 'New', date: '2025-01-15', start: '14:00', color: '#e74c3c' });
schedule.updateEvent('2', { title: 'Updated' });
schedule.deleteEvents('2');
schedule.getData();
schedule.undo();
schedule.redo();

Timeline Options

OptionTypeDescription
dataItem[]Array of timeline items
type'default' | 'monthly'Display mode
align'left' | 'right'Bullet alignment
order'asc' | 'desc'Sort order

Helpers

import { Helpers } from '@calendarjs/ce';

Helpers.now();                          // "2025-01-15 14:30:00"
Helpers.dateToNum(new Date());          // 45678 (Excel serial)
Helpers.numToDate(45678);               // "2025-01-15"
Helpers.prettify('2025-01-15 12:00');   // "2h ago"
Helpers.isValidDate(new Date());        // true
Helpers.isValidDateFormat('2025-01-15'); // true

TypeScript

Type definitions included. Import types:

import type { Calendar, Schedule, Timeline } from '@calendarjs/ce';

Documentation

calendarjs.com/docs

License

MIT