howljs / react-native-calendar-kit

React Native Calendar component, fully implemented using @shopify/flash-list, react-native-gesture-handler and react-native-reanimated. Support pinch to zoom, drag and drop to create/update event.
MIT License
379 stars 67 forks source link

onpressbackground not get current time when set start and end prop #71

Open arun-saleth opened 1 year ago

arun-saleth commented 1 year ago

when set start=7 end end=5 hour ,on while clicking 7-8 between it returns 12:00.the issue will happens all other hours also

@howljs can you check and fix this?

joaomellogomes commented 2 weeks ago

It happens to me as well. I'd really like to have this working with time range.

But a temporary workaround to me was add the value of startHour to the date that comes from onPressBackground event, like this:

const onPressBackground = (date: string) => {
    const start = dayjs(date).add(startHour, 'hours').toISOString()
    const end = dayjs(start).add(1, 'h')

    const newEvent: EventItem = {
      start,
      end: end.toISOString(),
      id: '1',
      title: 'Event',
      color: colors.purple500
    }
    setEvent(newEvent)
  }