@calendarjs/ce

中文文档
1.1.0发布于 2026/05/31MITTypeScriptCommonJS近 30 天下载 4014

A comprehensive JavaScript collection of calendar components including Calendar, Schedule, and Timeline with React and Vue support

原始使用文档
文档目录17 节
  1. Components
  2. Installation
  3. Quick Start
  4. Calendar
  5. Schedule
  6. Timeline
  7. React
  8. Vue
  9. Calendar Options
  10. Schedule Options
  11. Event Object
  12. Schedule Methods
  13. Timeline Options
  14. Helpers
  15. TypeScript
  16. Documentation
  17. License

CalendarJS

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

版本与发布记录

@calendarjs/ce 共发布 9 个版本,首次发布于 2025/10/26;过去 12 个月发布了 7 个版本。

版本发布日期距今
1.1.0latest2026/05/315 个月前
1.0.72026/05/016 个月前
1.0.62025/12/3110 个月前
1.0.52025/12/2410 个月前
1.0.42025/12/2410 个月前
1.0.32025/12/2010 个月前

关于 @calendarjs/ce 的常见问题

@calendarjs/ce 是什么?

A comprehensive JavaScript collection of calendar components including Calendar, Schedule, and Timeline with React and Vue support

如何安装 @calendarjs/ce?

在项目目录运行 npm install @calendarjs/ce,或使用 pnpm add / yarn add / bun add。

@calendarjs/ce 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@calendarjs/ce 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@calendarjs/ce 可以商用吗?

@calendarjs/ce 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@calendarjs/ce 的下载量有多少?

根据 npm 官方下载统计,@calendarjs/ce 在 2026/10/09 – 2026/11/07 这 30 天内被下载 4,014 次,日均约 134 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@calendarjs/ce 还在维护吗?

最新版本 1.1.0 发布于 2026/05/31(5 个月前);至今共发布 9 个版本,其中过去 12 个月发布了 7 个;首次发布于 2025/10/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。