-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event showing as all day event but in actual it is not all day event #2687
Comments
Any one can help me please ? |
+1 for me. Would like to see this fixed |
Please, it will help a lot. |
Have you all tried the This allows you to define when an event is or is not an all day event |
@nickcarnival No I didn't try that before. I will try and let you know |
@anjalikalsariya So I played around a bit with the I did find a work around that is not a great fix but may help you out... You can add one second to the end accessor like so: endAccessor={(e) => {
return moment(e.end).add(1, "s").toDate();
}} You'll also want to remove the This event will no longer show as all day: cc @dBianchii @wcbianchi this might solve one of your problems. It's a hack for sure but hopefully it helps one of you. |
Apologies for the brain dump but I became curious why the above hack "fixes" the issue. TLDR; the all day accessor will be ignored you have to make sure at least one of the hour, minute, second or millisecond are different between the Also, this could be wrong I'm not very familiar with this codebase. It does not seem like exclusively altering the I believe this is what determines whether or not to append an event to the all days array: events.forEach((event) => {
if (inRange(event, start, end, accessors, localizer)) {
let eStart = accessors.start(event),
eEnd = accessors.end(event)
if (
accessors.allDay(event) ||
localizer.startAndEndAreDateOnly(eStart, eEnd) ||
(!showMultiDayTimes && !localizer.isSameDate(eStart, eEnd))
) {
allDayEvents.push(event)
} else {
rangeEvents.push(event)
}
}
}) Using this date, which I took from your codesandbox, as an example: const exampleEvent = {
title: "Event title",
start: new Date(2015, 3, 0),
end: new Date(2015, 3, 0)
} We need this block to return false in order to not have an all day event: accessors.allDay(event) ||
localizer.startAndEndAreDateOnly(eStart, eEnd) ||
(!showMultiDayTimes && !localizer.isSameDate(eStart, eEnd)) Assuming we set our assessor to allDayAccessor={(e) => false} We still have the other conditions to deal with. We can set the This leaves us with only this condition export function isJustDate(date) {
return (
dates.hours(date) === 0 &&
dates.minutes(date) === 0 &&
dates.seconds(date) === 0 &&
dates.milliseconds(date) === 0
)
} So our It seems like the simplest way around this is to just add a second or millisecond to the end date which doesn't seem ideal to me. You could probably make a PR that changes this condition: accessors.allDay(event) ||
localizer.startAndEndAreDateOnly(eStart, eEnd) ||
(!showMultiDayTimes && !localizer.isSameDate(eStart, eEnd)) I'm not sure what the intended behavior would be, right now it seems as if start and end being equivalent SHOULD be an all day event. |
Thanks @nickcarnival, I tried this solution and its working for me - In events array ![]()
|
Check that this is really a bug
Reproduction link
https://codesandbox.io/p/sandbox/priceless-morning-9jzt7q?file=%2Fevents.js%3A6%2C31
Bug description
When event have same start and end date with time 12:00 AM. It is showing as all day event but it should be normal event. That Same event showing as normal event in google and outlook calendar.
Example ,
Start date is 27 Nov 12:00AM
End date is 27 Nov 12:00AM
React big calendar that I am usinng

Outlook calendar

Expected Behavior
I think it should behave same like outlook and google calendar
Start date is 27 Nov 12:00AM
End date is 27 Nov 12:00AM
Actual Behavior
Event showing as all day event but in actual it is not all day event
For example of this type of dates
react-big-calendar version
^1.13.1
React version
18.3.1
Platform/Target and Browser Versions
Mac OS - Chrome
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: