完整的日历营业时间

时间:2014-12-29 11:48:01

标签: fullcalendar

我正在尝试使用营业时间选项,但我无法反映这些变化。

我想显示多个营业时间

这是代码;

    $('#calendar').fullCalendar({
    header: {
      left: 'prev,next today',
      center: 'title',
      right: 'month,agendaWeek,agendaDay'
    },
    defaultDate: '2014-11-12',
    editable: true,
    eventLimit: true, // allow "more" link when too many events
    businessHours:
        [
        {
   start: '10:00', // a start time (10am in this example)
   end: '12:00', // an end time (12pm in this example)
   dow: [ 1,2,3,4 ]
   // days of week. an array of zero-based day of week integers (0=Sunday)
   // (Monday-Thursday in this example)
   },
   {
   start: '12:00', // a start time (12pm in this example)
   end: '18:00', // an end time (6pm in this example)
   dow: [ 1,2,3,4 ]
   // days of week. an array of zero-based day of week integers (0=Sunday)
   // (Monday-Thursday in this example)
   }]
  });  

4 个答案:

答案 0 :(得分:7)

喜欢这样

businessHours:
    {

            start: '11:00',
            end:   '12:00',
            dow: [ 1, 2, 3, 4, 5]
    },

为不同的班次使用不同的小时 - >使用背景事件

events:
[
    {
        id:    'available_hours',
        start: '2015-1-13T8:00:00',
        end:   '2015-1-13T19:00:00',
        rendering: 'background'
    },
    {
        id:    'work',
        start: '2015-1-13T10:00:00',
        end:   '2015-1-13T16:00:00',
        constraint: 'available_hours'
    }
]

有关详细信息,请参阅此链接, http://fullcalendar.io/docs/event_ui/eventConstraint/

根据您使用日历的方式,有几种不同的方法可以解决这个问题。希望约束的灵活性将帮助您获得所需的工作。

很高兴这个功能终于出现了!

答案 1 :(得分:0)

我必须在早上8点到晚上8点显示FullCaledar时间段固定,所以我做了一些R& D,并应用以下选项,它似乎工作正常!欢呼声。

jq('#calendar').fullCalendar({
        header: {
          left: 'prev,next',
          center: 'title',
          right: 'today,month,agendaWeek,resourceDay'
        },
        defaultView: 'resourceDay',
        allDaySlot: false,
        axisFormat: 'h:mm A',
        timeFormat: 'h:mm T',
        minTime: '08:00:00',
        maxTime: '20:00:00',

使用, minTime:'08:00:00', maxTime:'20:00:00'

感谢!!!

答案 2 :(得分:0)

另一方面,您可以定义工作时间和天数。

businessHours: [{
                        daysOfWeek: [1, 2, 3, 6, 7],
                        startTime: '08:00',
                        endTime: '23:00'
                    },
                    {
                        daysOfWeek: [4],
                        startTime: '08:00',
                        endTime: '16:00'
                    },
                    {
                        daysOfWeek: [5],
                        startTime: '15:00',
                        endTime: '23:00'
                    }
                ]

希望有帮助。

答案 3 :(得分:0)

在版本4中:

businessHours: {
  // days of week. an array of zero-based day of week integers (0=Sunday)
  daysOfWeek: [ 1, 2, 3, 4 ], // Monday - Thursday

  startTime: '10:00', // a start time (10am in this example)
  endTime: '18:00', // an end time (6pm in this example)
}

您还可以将营业时间声明分成多个对象,分为多个对象,以进行其他控制:

businessHours: [ // specify an array instead
  {
    daysOfWeek: [ 1, 2, 3 ], // Monday, Tuesday, Wednesday
    startTime: '08:00', // 8am
    endTime: '18:00' // 6pm
  },
  {
    daysOfWeek: [ 4, 5 ], // Thursday, Friday
    startTime: '10:00', // 10am
    endTime: '16:00' // 4pm
  }
]

在版本3中:

businessHours: {
  // days of week. an array of zero-based day of week integers (0=Sunday)
  dow: [ 1, 2, 3, 4 ], // Monday - Thursday

  start: '10:00', // a start time (10am in this example)
  end: '18:00', // an end time (6pm in this example)
}

您也可以将营业时间声明分成多个部分以进行其他控制(在v2.9.1中添加):

businessHours: [ // specify an array instead
  {
    dow: [ 1, 2, 3 ], // Monday, Tuesday, Wednesday
    start: '08:00', // 8am
    end: '18:00' // 6pm
  },
  {
    dow: [ 4, 5 ], // Thursday, Friday
    start: '10:00', // 10am
    end: '16:00' // 4pm
  }
]