国际化
传入任意 BCP-47 区域标签即可。日期与时间格式全部来自浏览器的 Intl API——无需打包语言资源。界面文案内置中英文,其他语言可轻松扩展。
区域、周首日与时制
周一
7
周二
8
周三
9
周四
10
周五
11
周六
12
周日
13
全天
1时
2时
3时
4时
5时
6时
7时
8时
9时
10时
11时
12时
13时
14时
15时
16时
17时
18时
19时
20时
21时
22时
23时
0时
locale 控制什么
- 月份/日期/星期名称、标题格式与时间标签(通过 Intl.DateTimeFormat)。
- 默认周首日(通过 Intl.Locale weekInfo,含安全回退)——可用 firstDayOfWeek 覆盖。
- 12/24 小时制——可用 hour12 覆盖。
- 内置 10 种语言的界面文案:en、zh、de、fr、es、pt、ja、ko、ru、it——其他语言回退到英文(可用 messages 覆盖)。
自定义界面文案
import type { CalendarMessages } from 'svelte5plus-calendar';
// Add a locale (or override single strings) via the messages prop:
const de: Partial<CalendarMessages> = {
today: 'Heute',
day: 'Tag',
week: 'Woche',
month: 'Monat',
year: 'Jahr',
agenda: 'Agenda',
allDay: 'Ganztägig',
more: (n) => `+${n} weitere`,
noEvents: 'Keine Termine'
};然后传给组件: <Calendar locale="de" messages={de} />
显示时区
通过 timeZone 属性传入 IANA 时区,整个日历即按该时区渲染。事件的 Date 依然是真实时刻——网格、弹层、快速新建与拖拽编辑都以目标时区显示和解释,编辑结果自动换算回真实时刻。
同一批事件,不同时区
周一
7
周二
8
周三
9
周四
10
周五
11
周六
12
周日
13
全天
1时
2时
3时
4时
5时
6时
7时
8时
9时
10时
11时
12时
13时
14时
15时
16时
17时
18时
19时
20时
21时
22时
23时
0时
重复事件注意 —
重复事件的“墙上时钟”跟随显示时区(9:30 的站会在你查看的时区里始终显示为 9:30)。锚定原时区的重复语义在路线图中。