简体   繁体   English

React-big-calendar:日视图,时间在第二天凌晨 1 点结束

[英]React-big-calendar : day view with time ending at 01am on next days

I'm currently working on a booking system and I'm using react-big-calendar for that.我目前正在开发一个预订系统,为此我正在使用 react-big-calendar。

The context : an establishment open at 9am and close at 2am (next day) and their client can book from 23pm to 01am.背景:营业时间为上午 9 点,凌晨 2 点(第二天)关闭,他们的客户可以在下午 23 点至凌晨 1 点之间进行预订。

The goal : display a day view starting at 9am and ending at 2am on next day目标:显示从早上 9 点开始到第二天凌晨 2 点结束的日视图

Question : Is it possible to achieve that with react-big-calendar?问题:是否可以通过 react-big-calendar 来实现? If no, do someone know a library I can use?如果不是,有人知道我可以使用的图书馆吗?

I tried我试过

<Calendar
    selectable
    min={new Date(2020, 9, 15, 9, 0, 0)}
    max={new Date(2020, 9, 16, 1, 0, 0)}
    date={selectedDay}
    localizer={localizer}
    defaultView={'day'}
    views={['day']}
    step={30}
    timeslots={2}
    events={events}
    onSelectSlot={handleSelectSlot}
/>

Not working and if an event starts à 23pm and end at 01am, it is marked as allDay event.不工作,如果一个事件从下午 23 点开始到凌晨 1 点结束,它被标记为全天事件。

Thanks for your help:)谢谢你的帮助:)

You just need to enabled the showMultiDayTimes prop, like:您只需要启用showMultiDayTimes道具,例如:

  return (
    <div style={{ height: 800 }}>
      <Calendar localizer={localizer} events={events} showMultiDayTimes={true} />
    </div>
  );

Here is a sandbox example .这是一个沙箱示例

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

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