完整日历中的多个营业时间,每天两班 [英] Mutliple business hours in full calendar with two shifts each day

查看:65
本文介绍了完整日历中的多个营业时间,每天两班的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将完整的日历集成到我的网站中.我的要求之一是要从数据库中获取工作时间并将其呈现在日历上.因此,基本上每天都有两班制(早上和晚上).我需要能够使用从数据库中填充的值来创建一个营业时间数组.开箱即用,我可以使用下面的代码来呈现常见的工作时间.

I have integrated full calendar into my website. One of my requirement is to have business hours fetch from database and render it on the calendar. So basically each day has two shifts(Morning and evening). I need to be able to create an array of business hours with the values getting populated from database. Out of the box, I'm able to use the below code to render a common business hours.

businessHours:
  {
    start: '10:00:00',
    end: '16:00:00',
    dow: [0,1,2,3,4,5,6]
  },

我想实现以下目标:

businessHours:[
{
  start: '10:00:00',
  end: '13:00:00',
  dow: [0]
},
{
  start: '14:00:00',
  end: '19:00:00',
  dow: [0]
},
{
  start: '09:00:00',
  end: '12:00:00',
  dow: [1]
},
{
  start: '12:30:00',
  end: '18:00:00',
  dow: [1]
},
]

如果使用完整日历的现有属性无法做到这一点,还有其他方法可以实现吗?预先谢谢你.

If this is not possible with the existing properties of full calendar, is there any other to achieve this ? Thank you in advance.

推荐答案

我还需要相同的功能.我将回购分叉给了

I also needed the same feature. I forked the repo to

https://github.com/dtmonterrey/fullcalendar

并实施了对我有用的解决方案.它可以使用单个businessHours定义或一系列businessHours定义(例如您尝试的示例).

and implemented a solution that works for me. It works with a single businessHours definition or with an array of businessHours definitions (like the example you tried).

示例:

    businessHours:[ 
        {
            start: '09:00',
            end: '13:00',
            dow: [1, 2]
        },
        {
            start: '14:00',
            end: '16:00',
            dow: [1, 2]
        },
        {
            start: '10:00',
            end: '19:00',
            dow: [4]
        },
        {
            start: '06:00',
            end: '10:30',
            dow: [6]
        },
        {
            start: '13:00',
            end: '17:00',
            dow: [6]
        },
        {
            start: '20:00',
            end: '23:00',
            dow: [6]
        }
    ]

我创建了一个拉取请求.欢迎提出建议.

I have created a pull request. Suggestions are welcome.

示例和演示

我无法让jsfiddle工作,所以演示了

I couldn't get jsfiddle to work, so the demo for

http://jsfiddle.net/t7aczbdt/

在这里

http://eo14.com/static/fullcalendar/

您可以在计算机上尝试:解压缩此 http://eo14.com/static/fullcalendar.zip 并使用浏览器打开.

You could try it on your computer: uncompress this http://eo14.com/static/fullcalendar.zip and open with your browser.

这篇关于完整日历中的多个营业时间,每天两班的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆