如何从Fullcalendar.js的时间表视图中删除假期

发布于 2025-02-03 17:47:00 字数 67 浏览 5 评论 0 原文

我想找到一种方法来从完整日历的时间表视图中删除几天,因为它们是公司假期。就像删除7月4日,阵亡将士纪念日等。我该怎么做?

I want to find a way to remove some days from the timeline view of full calendar because they are company holidays. like removing the 4th of July, memorial day etc. how do I do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七色彩虹 2025-02-10 17:47:00

不幸的是,不可能通过API完全将它们从显示屏上删除,但是您可以轻松地将它们标记为不可用或其他任何东西 - 也许通过使用背景事件的提要,每个假期中有一个事件。您可能可以从服务器中生成它们,或者在网上有公共日历,其中包含不同国家 /地区的官方假期,您可能可以将其用作来源。

背景事件与常规事件相同,除了更改其显示模式外 - 例如:

{
  start: '2022-06-01T10:00:00',
  end: '2022-06-01T16:00:00',
  display: 'background'
}

如果您还想停止人们在这些日期上创建事件或将事件拖到这些日期上,则可以通过适当的选项控制这些日期 /回调 - 完整的文档中有一些示例,例如该文档,可以阻止用户在背景事件之上创建新事件:

selectOverlap: function(event) {
  return event.rendering === 'background';
}

参考:

It's not possible to entirely remove them from the display via the API unfortunately, but you can easily mark them as unavailable or whatever - perhaps by using a feed of Background Events, with one event for each holiday. You can maybe generate them from your server, or there are public calendars online containing the official holidays of different countries, which you might be able to use as the source.

A background event is the same as a regular event, except its display mode is changed - for example:

{
  start: '2022-06-01T10:00:00',
  end: '2022-06-01T16:00:00',
  display: 'background'
}

If you additionally want to stop people creating events on those dates, or dragging events onto those dates, that can be controlled through the appropriate options / callbacks - there are examples in the fullCalendar documentation, such as this one which will prevent a user creating a new event on top of a background event:

selectOverlap: function(event) {
  return event.rendering === 'background';
}

References:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文