syncfusion-flutter-calendar-datepicker
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSyncfusion Flutter Calendar & Date Range Picker
Syncfusion Flutter 日历与日期范围选择器
This skill covers two related Syncfusion Flutter components for date and calendar functionality: SfCalendar (Event Calendar) and SfDateRangePicker (Date Range Picker). While they share many visual and configuration features, they serve different primary purposes.
本技能介绍两款用于实现日期和日历功能的Syncfusion Flutter相关组件:SfCalendar(事件日历)和SfDateRangePicker(日期范围选择器)。二者共享许多视觉和配置特性,但核心用途不同。
When to Use This Skill
适用场景
Use this skill when you need to:
- Implement event calendars with appointments, scheduling, and time management
- Add date selection to forms, filters, or booking interfaces
- Display calendar views (month, week, day, year, decade, timeline, schedule)
- Handle date range selection for reports, analytics, or filtering
- Create appointment/booking systems with recurring events and time zones
- Build scheduling interfaces with drag-drop, resizing, and resource views
- Enable date navigation with various view modes and restrictions
- Customize calendar appearance with builders, themes, and styling
- Support multiple date selection modes (single, multiple, range, multi-range)
- Integrate calendar localization with RTL support and accessibility
当你需要实现以下需求时可使用本技能:
- 实现事件日历,支持预约、日程安排和时间管理
- 为表单、筛选器或预订界面添加日期选择功能
- 展示日历视图(月、周、日、年、十年、时间轴、日程)
- 为报表、分析或筛选处理日期范围选择
- 创建预约/预订系统,支持重复事件和时区配置
- 构建调度界面,支持拖拽、调整大小和资源视图
- 支持多种视图模式和限制规则的日期导航
- 通过构建器、主题和样式自定义日历外观
- 支持多种日期选择模式(单选、多选、范围选择、多范围选择)
- 集成日历本地化,支持RTL(从右到左)布局和无障碍访问
Choosing the Right Component
如何选择合适的组件
Use SfCalendar (Event Calendar) when:
选择SfCalendar(事件日历)的场景:
- You need to display and manage appointments/events
- Your app requires scheduling functionality (booking, meetings, tasks)
- You need timeline views or schedule views for event management
- Time-based views are important (day, week, workweek with time slots)
- You need recurring events, time zones, or resource allocation
- Drag-and-drop or appointment resizing is required
- Building calendars for: meeting schedulers, appointment books, task managers, event planners
- 你需要展示和管理预约/事件
- 你的应用需要调度功能(预订、会议、任务)
- 你需要时间轴视图或日程视图来管理事件
- 基于时间的视图很重要(带时间槽的日、周、工作周视图)
- 你需要重复事件、时区或资源分配能力
- 需要拖拽或预约时长调整功能
- 适用场景:会议调度器、预约本、任务管理器、活动规划器
Use SfDateRangePicker (Date Range Picker) when:
选择SfDateRangePicker(日期范围选择器)的场景:
- You need date selection without appointment management
- Your primary goal is picking dates or date ranges for forms/filters
- You need flexible selection modes (single, multiple, range, multi-range)
- Simplified date input for booking start/end dates, report periods, etc.
- You want action buttons (confirm/cancel) for date selection dialogs
- Building UI for: date filters, booking dates, report date ranges, form date inputs
- 你只需要日期选择,不需要预约管理功能
- 你的核心需求是为表单/筛选器选择日期或日期范围
- 你需要灵活的选择模式(单选、多选、范围选择、多范围选择)
- 用于预订起止日期、报表周期等场景的轻量化日期输入
- 你需要日期选择弹窗的操作按钮(确认/取消)
- 适用场景:日期筛选器、预订日期选择、报表日期范围、表单日期输入
Key Differences Summary:
核心差异汇总:
| Feature | SfCalendar | SfDateRangePicker |
|---|---|---|
| Primary Purpose | Event scheduling & display | Date selection |
| Appointments/Events | ✅ Full support | ❌ Not supported |
| View Types | 9 views (day, week, timeline, etc.) | 4 views (month, year, decade, century) |
| Selection Modes | Single date/time slot | Single, multiple, range, multi-range |
| Time Slots | ✅ Yes (with time) | ❌ Dates only |
| Action Buttons | ❌ No | ✅ Confirm/Cancel buttons |
| Recurring Events | ✅ Yes | ❌ No |
| Time Zones | ✅ Yes | ❌ No |
| Resource View | ✅ Yes | ❌ No |
| Drag & Drop | ✅ Yes | ❌ No |
| 功能 | SfCalendar | SfDateRangePicker |
|---|---|---|
| 主要用途 | 事件调度与展示 | 日期选择 |
| 预约/事件 | ✅ 完全支持 | ❌ 不支持 |
| 视图类型 | 9种视图(日、周、时间轴等) | 4种视图(月、年、十年、世纪) |
| 选择模式 | 单日期/时间槽选择 | 单选、多选、范围选择、多范围选择 |
| 时间槽 | ✅ 支持(带时间) | ❌ 仅支持日期 |
| 操作按钮 | ❌ 无 | ✅ 支持确认/取消按钮 |
| 重复事件 | ✅ 支持 | ❌ 不支持 |
| 时区 | ✅ 支持 | ❌ 不支持 |
| 资源视图 | ✅ 支持 | ❌ 不支持 |
| 拖拽功能 | ✅ 支持 | ❌ 不支持 |
Documentation and Navigation Guide
文档与导航指南
Getting Started
入门指南
📄 Read: references/getting-started.md
- Installation and package setup for both components
- Basic SfCalendar implementation
- Basic SfDateRangePicker implementation
- Package dependencies and imports
- Quick comparison and first examples
📄 阅读: references/getting-started.md
- 两个组件的安装与包配置
- 基础SfCalendar实现
- 基础SfDateRangePicker实现
- 包依赖与导入
- 快速对比与入门示例
Component Overview
组件概览
📄 For Calendar: references/calendar-overview.md
- SfCalendar widget overview and features
- When to use Calendar vs Date Range Picker
- Nine calendar view types explained
- Calendar-specific capabilities
- Basic calendar configuration
📄 For Date Range Picker: references/datepicker-overview.md
- SfDateRangePicker widget overview and features
- When to use Date Range Picker vs Calendar
- Four picker view types explained
- Date picker-specific capabilities
- Multi-picker view (side by side)
📄 日历相关: references/calendar-overview.md
- SfCalendar组件概览与特性
- 日历与日期范围选择器的适用场景差异
- 9种日历视图类型说明
- 日历专属能力介绍
- 基础日历配置
📄 日期范围选择器相关: references/datepicker-overview.md
- SfDateRangePicker组件概览与特性
- 日期范围选择器与日历的适用场景差异
- 4种选择器视图类型说明
- 日期选择器专属能力介绍
- 多选择器视图(并排展示)
View Types and Navigation
视图类型与导航
📄 Read: references/views.md
- Month view (both components)
- Year, decade, century views (Date Range Picker)
- Day, week, workweek views (Calendar)
- Schedule view (Calendar)
- Timeline views: day, week, workweek, month (Calendar)
- Month agenda view (Calendar)
- View switching and navigation
- Week number display
- First day of week configuration
📄 Read: references/date-navigations.md
- Forward and backward navigation
- Programmatic date navigation
- Initial display date configuration
- Navigation arrows
- View mode switching controls
- Min/max date restrictions
- Blackout dates (disabled dates)
📄 阅读: references/views.md
- 月视图(两个组件均支持)
- 年、十年、世纪视图(日期范围选择器)
- 日、周、工作周视图(日历)
- 日程视图(日历)
- 时间轴视图:日、周、工作周、月(日历)
- 月议程视图(日历)
- 视图切换与导航
- 周数展示
- 周首日配置
📄 阅读: references/date-navigations.md
- 前后导航
- 编程式日期导航
- 初始展示日期配置
- 导航箭头
- 视图模式切换控件
- 最小/最大日期限制
- 禁用日期(黑名单日期)
Calendar-Specific Features
日历专属特性
📄 Read: references/appointments.md
- Calendar appointments (events/scheduling)
- Appointment class and properties
- CalendarDataSource setup and mapping
- Custom appointment objects
- All-day appointments
- Recurring appointments and rules
- Appointment display modes
- Time zone support for appointments
- Appointment customization
📄 阅读: references/appointments.md
- 日历预约(事件/调度)
- 预约类与属性
- CalendarDataSource配置与映射
- 自定义预约对象
- 全天预约
- 重复预约与规则
- 预约展示模式
- 预约时区支持
- 预约自定义
Date Range Picker-Specific Features
日期范围选择器专属特性
📄 Read: references/selections.md
- Selection modes (single, multiple, range, multi-range, extendable)
- Single date selection
- Multiple date selection
- Range selection (start and end dates)
- Multi-range selection (multiple ranges)
- Programmatic selection
- Selection changed callbacks
- Initial selected date
- Selection decoration and styling
📄 阅读: references/selections.md
- 选择模式(单选、多选、范围选择、多范围选择、可扩展范围)
- 单日期选择
- 多日期选择
- 范围选择(起止日期)
- 多范围选择(多个范围)
- 编程式选择
- 选择变更回调
- 初始选中日期
- 选择装饰与样式
Customization and Styling
自定义与样式
📄 Read: references/customization.md
- Visual appearance customization
- Cell styling and colors
- Header customization
- Today highlight color
- Cell border color and background
- Selection decoration
- Theme integration
- Special time regions (Calendar)
- Month cell appearance
📄 Read: references/builders.md
- Custom cell builders
- Month cell builder
- Year cell builder
- Appointment builder (Calendar)
- Time region builder (Calendar)
- Resource header builder (Calendar)
- Builder patterns and examples
📄 阅读: references/customization.md
- 视觉外观自定义
- 单元格样式与颜色
- 头部自定义
- 今日高亮颜色
- 单元格边框颜色与背景
- 选择装饰
- 主题集成
- 特殊时间区域(日历)
- 月单元格外观
📄 阅读: references/builders.md
- 自定义单元格构建器
- 月单元格构建器
- 年单元格构建器
- 预约构建器(日历)
- 时间区域构建器(日历)
- 资源头部构建器(日历)
- 构建器模式与示例
Event Handling
事件处理
📄 Read: references/callbacks.md
- onSelectionChanged (both components)
- onViewChanged (both components)
- onTap and onLongPress (Calendar)
- onSubmit and onCancel (Date Range Picker)
- Calendar-specific callbacks (appointment interactions)
- Callback argument types
- Event handling patterns
📄 阅读: references/callbacks.md
- onSelectionChanged(两个组件均支持)
- onViewChanged(两个组件均支持)
- onTap和onLongPress(日历)
- onSubmit和onCancel(日期范围选择器)
- 日历专属回调(预约交互)
- 回调参数类型
- 事件处理模式
Localization and Accessibility
本地化与无障碍访问
📄 Read: references/localization.md
- Internationalization support
- Locale configuration
- Date format customization
- Header and cell formats
- Globalization examples
- Right-to-left (RTL) support
📄 Read: references/accessibility.md
- Screen reader support
- Semantic labels
- Keyboard navigation
- WCAG compliance
- Focus indicators
- Accessible date selection
📄 阅读: references/localization.md
- 国际化支持
- 区域设置配置
- 日期格式自定义
- 头部与单元格格式
- 全球化示例
- RTL(从右到左)布局支持
📄 阅读: references/accessibility.md
- 屏幕阅读器支持
- 语义标签
- 键盘导航
- WCAG合规
- 焦点指示器
- 无障碍日期选择
Advanced Features
高级特性
📄 Read: references/advanced-features.md
- Time zones (Calendar)
- Resource view (Calendar)
- Drag and drop (Calendar)
- Appointment resizing (Calendar)
- Load more appointments (Calendar)
- Hijri calendar support (Date Range Picker)
- Date restrictions and constraints (Date Range Picker)
- Action buttons (Date Range Picker)
- Current time indicator (Calendar)
📄 阅读: references/advanced-features.md
- 时区(日历)
- 资源视图(日历)
- 拖拽功能(日历)
- 预约大小调整(日历)
- 加载更多预约(日历)
- Hijri日历支持(日期范围选择器)
- 日期限制与约束(日期范围选择器)
- 操作按钮(日期范围选择器)
- 当前时间指示器(日历)
Quick Start Examples
快速入门示例
Basic Calendar with Appointments
带预约的基础日历
dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
class MyCalendar extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('My Calendar')),
body: SfCalendar(
view: CalendarView.month,
dataSource: MeetingDataSource(_getDataSource()),
monthViewSettings: MonthViewSettings(
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment
),
),
);
}
List<Meeting> _getDataSource() {
final List<Meeting> meetings = <Meeting>[];
final DateTime today = DateTime.now();
final DateTime startTime = DateTime(today.year, today.month, today.day, 9, 0, 0);
final DateTime endTime = startTime.add(Duration(hours: 2));
meetings.add(Meeting(
'Conference',
startTime,
endTime,
Color(0xFF0F8644),
false
));
return meetings;
}
}
class MeetingDataSource extends CalendarDataSource {
MeetingDataSource(List<Meeting> source) {
appointments = source;
}
DateTime getStartTime(int index) => appointments![index].from;
DateTime getEndTime(int index) => appointments![index].to;
String getSubject(int index) => appointments![index].eventName;
Color getColor(int index) => appointments![index].background;
bool isAllDay(int index) => appointments![index].isAllDay;
}
class Meeting {
Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
String eventName;
DateTime from;
DateTime to;
Color background;
bool isAllDay;
}dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
class MyCalendar extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('My Calendar')),
body: SfCalendar(
view: CalendarView.month,
dataSource: MeetingDataSource(_getDataSource()),
monthViewSettings: MonthViewSettings(
appointmentDisplayMode: MonthAppointmentDisplayMode.appointment
),
),
);
}
List<Meeting> _getDataSource() {
final List<Meeting> meetings = <Meeting>[];
final DateTime today = DateTime.now();
final DateTime startTime = DateTime(today.year, today.month, today.day, 9, 0, 0);
final DateTime endTime = startTime.add(Duration(hours: 2));
meetings.add(Meeting(
'Conference',
startTime,
endTime,
Color(0xFF0F8644),
false
));
return meetings;
}
}
class MeetingDataSource extends CalendarDataSource {
MeetingDataSource(List<Meeting> source) {
appointments = source;
}
DateTime getStartTime(int index) => appointments![index].from;
DateTime getEndTime(int index) => appointments![index].to;
String getSubject(int index) => appointments![index].eventName;
Color getColor(int index) => appointments![index].background;
bool isAllDay(int index) => appointments![index].isAllDay;
}
class Meeting {
Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
String eventName;
DateTime from;
DateTime to;
Color background;
bool isAllDay;
}Basic Date Range Picker
基础日期范围选择器
dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
class MyDatePicker extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Select Date Range')),
body: SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: _onSelectionChanged,
showActionButtons: true,
),
);
}
void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
if (args.value is PickerDateRange) {
final DateTime startDate = args.value.startDate;
final DateTime? endDate = args.value.endDate;
print('Selected range: $startDate to $endDate');
}
}
}dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
class MyDatePicker extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Select Date Range')),
body: SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: _onSelectionChanged,
showActionButtons: true,
),
);
}
void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
if (args.value is PickerDateRange) {
final DateTime startDate = args.value.startDate;
final DateTime? endDate = args.value.endDate;
print('Selected range: $startDate to $endDate');
}
}
}Date Picker with Multiple Selection
多选日期选择器
dart
SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.multiple,
initialSelectedDates: [
DateTime.now(),
DateTime.now().add(Duration(days: 2)),
DateTime.now().add(Duration(days: 5)),
],
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
final List<DateTime> selectedDates = args.value;
print('Selected ${selectedDates.length} dates');
},
)dart
SfDateRangePicker(
view: DateRangePickerView.month,
selectionMode: DateRangePickerSelectionMode.multiple,
initialSelectedDates: [
DateTime.now(),
DateTime.now().add(Duration(days: 2)),
DateTime.now().add(Duration(days: 5)),
],
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
final List<DateTime> selectedDates = args.value;
print('Selected ${selectedDates.length} dates');
},
)Common Patterns
常用模式
Pattern 1: Calendar with Different Views
模式1:多视图切换日历
dart
// Switch between day, week, month, and schedule views
CalendarView _calendarView = CalendarView.month;
SfCalendar(
view: _calendarView,
dataSource: MeetingDataSource(_appointments),
onViewChanged: (ViewChangedDetails details) {
// Handle view changes
},
)
// Toggle view with buttons
void _changeView(CalendarView view) {
setState(() {
_calendarView = view;
});
}dart
// 在日、周、月、日程视图之间切换
CalendarView _calendarView = CalendarView.month;
SfCalendar(
view: _calendarView,
dataSource: MeetingDataSource(_appointments),
onViewChanged: (ViewChangedDetails details) {
// 处理视图变更
},
)
// 用按钮切换视图
void _changeView(CalendarView view) {
setState(() {
_calendarView = view;
});
}Pattern 2: Date Range Filter for Reports
模式2:报表日期范围筛选器
dart
// Common pattern for selecting date ranges in analytics/reports
PickerDateRange? _selectedRange;
SfDateRangePicker(
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
setState(() {
_selectedRange = args.value;
});
},
showActionButtons: true,
onSubmit: (Object? value) {
if (_selectedRange != null) {
_loadReportData(_selectedRange!.startDate, _selectedRange!.endDate);
}
Navigator.pop(context);
},
)dart
// 分析/报表场景常用的日期范围选择模式
PickerDateRange? _selectedRange;
SfDateRangePicker(
selectionMode: DateRangePickerSelectionMode.range,
onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
setState(() {
_selectedRange = args.value;
});
},
showActionButtons: true,
onSubmit: (Object? value) {
if (_selectedRange != null) {
_loadReportData(_selectedRange!.startDate, _selectedRange!.endDate);
}
Navigator.pop(context);
},
)Pattern 3: Customized Cell Appearance
模式3:自定义单元格外观
dart
// Custom styling for both components
SfCalendar(
view: CalendarView.month,
todayHighlightColor: Colors.blue,
cellBorderColor: Colors.grey[300],
backgroundColor: Colors.white,
selectionDecoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: Colors.blue, width: 2),
borderRadius: BorderRadius.circular(4),
),
)
SfDateRangePicker(
todayHighlightColor: Colors.green,
selectionColor: Colors.blue,
rangeSelectionColor: Colors.blue.withOpacity(0.3),
startRangeSelectionColor: Colors.blue,
endRangeSelectionColor: Colors.blue,
)dart
// 两个组件通用的自定义样式
SfCalendar(
view: CalendarView.month,
todayHighlightColor: Colors.blue,
cellBorderColor: Colors.grey[300],
backgroundColor: Colors.white,
selectionDecoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: Colors.blue, width: 2),
borderRadius: BorderRadius.circular(4),
),
)
SfDateRangePicker(
todayHighlightColor: Colors.green,
selectionColor: Colors.blue,
rangeSelectionColor: Colors.blue.withOpacity(0.3),
startRangeSelectionColor: Colors.blue,
endRangeSelectionColor: Colors.blue,
)Pattern 4: Restricting Date Selection
模式4:限制日期选择范围
dart
// Disable past dates and weekends
SfDateRangePicker(
minDate: DateTime.now(),
maxDate: DateTime.now().add(Duration(days: 365)),
selectableDayPredicate: (DateTime date) {
// Disable weekends
return date.weekday != DateTime.saturday &&
date.weekday != DateTime.sunday;
},
)dart
// 禁用过去日期和周末
SfDateRangePicker(
minDate: DateTime.now(),
maxDate: DateTime.now().add(Duration(days: 365)),
selectableDayPredicate: (DateTime date) {
// 禁用周末
return date.weekday != DateTime.saturday &&
date.weekday != DateTime.sunday;
},
)Key Properties
核心属性
SfCalendar Essential Properties
SfCalendar核心属性
- - Calendar view type (day, week, month, schedule, timeline, etc.)
view - - CalendarDataSource with appointments
dataSource - - Date to display initially
initialDisplayDate - - Initially selected date/time
initialSelectedDate - - Configuration for month view
monthViewSettings - - Configuration for day/week views
timeSlotViewSettings - - Configuration for schedule view
scheduleViewSettings - - Color for today's date
todayHighlightColor - - Selection styling
selectionDecoration - - Callback when cell is tapped
onTap - - Callback for long press
onLongPress - - Callback when view changes
onViewChanged - - Callback when selection changes
onSelectionChanged - - Show forward/backward arrows
showNavigationArrow - - Show current time line
showCurrentTimeIndicator - - Allow switching between views
allowViewNavigation - - First day of week (1-7)
firstDayOfWeek - - Dates to disable
blackoutDates - /
minDate- Date range restrictionsmaxDate
- - 日历视图类型(日、周、月、日程、时间轴等)
view - - 包含预约数据的CalendarDataSource
dataSource - - 初始展示的日期
initialDisplayDate - - 初始选中的日期/时间
initialSelectedDate - - 月视图配置
monthViewSettings - - 日/周视图配置
timeSlotViewSettings - - 日程视图配置
scheduleViewSettings - - 今日日期高亮颜色
todayHighlightColor - - 选中样式
selectionDecoration - - 单元格点击回调
onTap - - 单元格长按回调
onLongPress - - 视图变更回调
onViewChanged - - 选中内容变更回调
onSelectionChanged - - 展示前后导航箭头
showNavigationArrow - - 展示当前时间线
showCurrentTimeIndicator - - 允许在视图之间切换
allowViewNavigation - - 周首日(1-7)
firstDayOfWeek - - 禁用的日期
blackoutDates - /
minDate- 可选日期范围限制maxDate
SfDateRangePicker Essential Properties
SfDateRangePicker核心属性
- - Picker view type (month, year, decade, century)
view - - Selection mode (single, multiple, range, multiRange, extendableRange)
selectionMode - - Initially selected date
initialSelectedDate - - Initially selected dates (multiple mode)
initialSelectedDates - - Initially selected range
initialSelectedRange - - Initially selected ranges (multi-range mode)
initialSelectedRanges - - Date to display initially
initialDisplayDate - - Configuration for month view
monthViewSettings - - Configuration for year view
yearViewSettings - - Color for today's date
todayHighlightColor - - Selection color
selectionColor - - Range selection color
rangeSelectionColor - - Start date color
startRangeSelectionColor - - End date color
endRangeSelectionColor - - Callback when selection changes
onSelectionChanged - - Callback when view changes
onViewChanged - - Callback when confirm button pressed
onSubmit - - Callback when cancel button pressed
onCancel - - Show confirm/cancel buttons
showActionButtons - - Show today button
showTodayButton - - Allow switching between views
allowViewNavigation - - Enable past date selection
enablePastDates - /
minDate- Date range restrictionsmaxDate - - Custom date validation
selectableDayPredicate - - Month cell styling
monthCellStyle - - Year cell styling
yearCellStyle
- - 选择器视图类型(月、年、十年、世纪)
view - - 选择模式(单选、多选、范围选择、多范围选择、可扩展范围)
selectionMode - - 初始选中的日期
initialSelectedDate - - 初始选中的日期列表(多选模式)
initialSelectedDates - - 初始选中的范围
initialSelectedRange - - 初始选中的范围列表(多范围模式)
initialSelectedRanges - - 初始展示的日期
initialDisplayDate - - 月视图配置
monthViewSettings - - 年视图配置
yearViewSettings - - 今日日期高亮颜色
todayHighlightColor - - 选中颜色
selectionColor - - 范围选中颜色
rangeSelectionColor - - 范围起始日期颜色
startRangeSelectionColor - - 范围结束日期颜色
endRangeSelectionColor - - 选中内容变更回调
onSelectionChanged - - 视图变更回调
onViewChanged - - 确认按钮点击回调
onSubmit - - 取消按钮点击回调
onCancel - - 展示确认/取消按钮
showActionButtons - - 展示今日按钮
showTodayButton - - 允许在视图之间切换
allowViewNavigation - - 允许选择过去的日期
enablePastDates - /
minDate- 可选日期范围限制maxDate - - 自定义日期校验规则
selectableDayPredicate - - 月单元格样式
monthCellStyle - - 年单元格样式
yearCellStyle
Common Use Cases
常见使用场景
- Meeting Scheduler - Use SfCalendar with schedule view
- Event Manager - Use SfCalendar with month view, recurring events, and drag-drop
- Booking System - Use SfDateRangePicker with range selection and date restrictions
- Date Filter - Use SfDateRangePicker with range/multi-range selection for reports
- Task Manager - Use SfCalendar with schedule view and all-day appointments
- Vacation Planner - Use SfDateRangePicker with multiple selection and blackout dates
- Resource Scheduler - Use SfCalendar with resource view and timeline
- Simple Date Input - Use SfDateRangePicker with single selection mode
- 会议调度器 - 使用带日程视图的SfCalendar
- 活动管理器 - 使用带月视图、重复事件和拖拽功能的SfCalendar
- 预订系统 - 使用带范围选择和日期限制的SfDateRangePicker
- 日期筛选器 - 使用带范围/多范围选择的SfDateRangePicker用于报表
- 任务管理器 - 使用带日程视图和全天预约的SfCalendar
- 假期规划器 - 使用带多选和禁用日期的SfDateRangePicker
- 资源调度器 - 使用带资源视图和时间轴的SfCalendar
- 简易日期输入 - 使用单选模式的SfDateRangePicker