简体   繁体   English

如何让我的营业时间出现在周末?

[英]How do I make my business hours appear on weekends?

I am using the premium scheduler plugin, and have my resources created with business hours set up with the following implementation: https://fullcalendar.io/docs/businessHours-per-resource我正在使用高级调度程序插件,并使用以下实现设置工作时间创建资源: https://fullcalendar.io/docs/businessHours-per-resource

This works fine, and I am only displaying one day at a time, so I have not included the daysOfWeek attribute within the object.这很好用,我一次只显示一天,所以我没有在 object 中包含daysOfWeek属性。

My issue is that when I am on a day that is a Saturday or Sunday, the business hours do not render.我的问题是,当我在星期六或星期日的一天时,营业时间不会呈现。 The entire day is greyed out as if the resource is unavailable that day, which in my case is not true.一整天都是灰色的,就好像那天资源不可用一样,在我的情况下这是不正确的。

Is there some attribute I am missing on the calendar model?日历 model 上是否缺少某些属性? Something like showBusinessHoursOnWeekends: true ?showBusinessHoursOnWeekends: true类的东西?

You mentioned you didn't include the daysOfWeek setting for your business hours.您提到您的工作时间没有包括daysOfWeek设置。 You said you did this because "I am only displaying one day at a time".你说你这样做是因为“我一次只展示一天”。 However this makes no sense.然而,这没有任何意义。 The daysOfWeek setting specifies which days of the week the business hours apply to. daysOfWeek设置指定营业时间适用于一周中的哪几天。 It has no relationship to how many days your calendar's view is displaying simultaneously.它与您的日历视图同时显示多少天无关。 FullCalendar still needs to know which calendar days to show business hours for, and which not to, so that when the user moves to the next day, it knows what to show. FullCalendar 仍然需要知道哪些日历日显示营业时间,哪些不显示,这样当用户移动到第二天时,它知道要显示什么。

If you don't include daysOfWeek , fullCalendar defaults to assuming Monday-Friday.如果您不包括daysOfWeek ,则 fullCalendar 默认假设为周一至周五。 (This is not documented, but the behaviour is observable by simply removing the setting from any existing businessHours definition.). (这没有记录,但只需从任何现有的 businessHours 定义中删除设置即可观察到该行为。)。

If we set up a simple demo using a businesshours where the same hours apply 7 days a week we can see that in all views, the business hours are shown correctly all days.如果我们使用工作时间设置一个简单的演示,每周 7 天使用相同的时间,我们可以看到在所有视图中,工作时间全天都正确显示。 Demo: https://codepen.io/ADyson82/pen/OJyGGeJ .演示: https://codepen.io/ADyson82/pen/OJyGGeJ

Adding this one line of code is all you need to do to solve your problem:添加这一行代码就是解决问题所需要做的所有事情:

  daysOfWeek: [ 0, 1, 2, 3, 4, 5, 6 ],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM