Skip to content
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

Schedule: Creating an event 1 day apart at midnight, places the event on the same day #9775

Closed
newk5 opened this issue Feb 8, 2023 · 16 comments · Fixed by #9777
Closed

Schedule: Creating an event 1 day apart at midnight, places the event on the same day #9775

newk5 opened this issue Feb 8, 2023 · 16 comments · Fixed by #9777
Assignees
Labels
Resolution: By Design The behavior in the issue is by design and the component exhibits the expected behavior third-party Issue is tracked in 3rd party library

Comments

@newk5
Copy link
Contributor

newk5 commented Feb 8, 2023

Describe the bug

If you create an event with start date 15/02/2023 00:00 and end date 16/02/2023 00:00 the event will only be placed on 1 day in the calendar.

Reproducer

  1. Go to https://www.primefaces.org/showcase/ui/data/schedule/basic.xhtml
  2. Follow these steps
chrome_DWuK9blSwD.mp4

Expected behavior

The schedule should place the event spanning over the 2 days (2 squares in the schedule) since the it goes from the midnight of the day before to the midnight of the day after. But instead it just places it as if the start and end data are on the same day.

PrimeFaces edition

Community

PrimeFaces version

12

Theme

Prestige

JSF implementation

All

JSF version

All?

Java version

All?

Browser(s)

All?

@newk5 newk5 added ‼️ needs-triage Issue needs triaging 🐞 defect Bug...Something isn't working labels Feb 8, 2023
@melloware
Copy link
Member

Can you confirm if your issue is this or not: #9041 ???

@newk5
Copy link
Contributor Author

newk5 commented Feb 8, 2023

Hmm seems similar but I dont think its the same, I think that one is related to the day and week view mode only.
Sorry I should also specify I'm actually not using PF12 but PF13 snapshot instead which I compiled soon after the release of PF12, around december I think, which I believe was after you fixed #9041 so I think I have that fix already.

@melloware
Copy link
Member

ok i think this might be FC related can you try my 23:59 trick and see if that works?

@newk5
Copy link
Contributor Author

newk5 commented Feb 8, 2023

yea I can confirm if the end date has the hour of 23:59 instead of 00:00, it shows properly

@melloware
Copy link
Member

Yep its the same FullCalendar bug. as #9041

@melloware melloware added third-party Issue is tracked in 3rd party library 🐞 defect Bug...Something isn't working and removed 🐞 defect Bug...Something isn't working ‼️ needs-triage Issue needs triaging labels Feb 8, 2023
@melloware
Copy link
Member

Its possible its fixed in a later Full Calendar but updating FC is always scary because they change so much between releases.

@newk5
Copy link
Contributor Author

newk5 commented Feb 8, 2023

Yep its the same FullCalendar bug. as #9041

ah I see, I thought it might be different since I'm using the month view but I guess the cause is the same.

@newk5
Copy link
Contributor Author

newk5 commented Feb 9, 2023

Its possible its fixed in a later Full Calendar but updating FC is always scary because they change so much between releases.

It seems the current version primefaces is using is a bit old, it's using v5.10.1 from November 2021, maybe an update is due? There is now version 6, which according to the release notes has minimal breaking changes but I guess a safer update would be to the last v5 version (5.11.3) instead I suppose.

@melloware
Copy link
Member

Yep I can take a look at this. 5.11.3 should be easy. the 6 upgrade we can then try and see how big of a pain it is!

@melloware melloware self-assigned this Feb 9, 2023
@newk5
Copy link
Contributor Author

newk5 commented Feb 9, 2023

Thanks, let me know whenever you push it, I can pull it and rebuild PF from source to test it out and then report back if I noticed any bugs or other issues.

melloware added a commit to melloware/primefaces that referenced this issue Feb 9, 2023
@melloware
Copy link
Member

OK going to 5.11.3 letting the build run now. Seems to work OK. I tried to go to 6.1.4 and got some JS errors I didn't feel like investigating 😄

@newk5
Copy link
Contributor Author

newk5 commented Feb 10, 2023

Ok I pulled it and compiled from source but seems like some pages on my app with datatables no longer open, I get a:

	at org.primefaces.model.filter.FilterConstraints.lambda$of$0(FilterConstraints.java:64)
	at java.base/java.util.Optional.orElseThrow(Optional.java:403)
	at org.primefaces.model.filter.FilterConstraints.of(FilterConstraints.java:64)
	at org.primefaces.model.FilterMeta.of(FilterMeta.java:105)
	at org.primefaces.component.api.UITable.lambda$initFilterBy$0(UITable.java:70)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:89)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:55)
	at org.primefaces.component.api.ColumnAware.forEachColumn(ColumnAware.java:51)
	at org.primefaces.component.api.UITable.initFilterBy(UITable.java:69)
	at org.primefaces.component.datatable.DataTable.lambda$getFilterByAsMap$4(DataTable.java:1128)
	at org.primefaces.util.ComponentUtils.eval(ComponentUtils.java:545)
	at org.primefaces.component.datatable.DataTable.getFilterByAsMap(DataTable.java:1128)
	at org.primefaces.component.datatable.DataTableRenderer.preRender(DataTableRenderer.java:114)
	at org.primefaces.component.datatable.DataTableRenderer.render(DataTableRenderer.java:101)
	at org.primefaces.component.datatable.DataTableRenderer.encodeEnd(DataTableRenderer.java:94)
	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:649)

I think #9767 broke something

@newk5
Copy link
Contributor Author

newk5 commented Feb 10, 2023

Ok I changed the FilterConstraints#of to return null when being passed a null match mode just like it was before which fixed the issue, could make a PR but maybe @Rapster had something different in mind?

Anyway I tested 5.11.3 but it seems the issue is still there. Are we sure this is a FullCalendar issue? Could this also be something with how Primefaces is passing the dates to the FullCalendar library?

In regards to v6, there is a migration guide here: https://fullcalendar.io/docs/upgrading-from-v5

@Rapster
Copy link
Member

Rapster commented Feb 10, 2023

Thanks for reporting @newk5 I'll have a look

@melloware
Copy link
Member

Can you submit a PR for the filter constraint issue. That feels like a regression bug

As for FC I think it's a bug on their side else 23:59:59 shouldn't make it work.

@newk5
Copy link
Contributor Author

newk5 commented Feb 10, 2023

Ok looking at the fullcalendar docs, I can see now that they dont consider this a bug but a feature. Even in v6, end dates are exclusive by default and it seems like there is no (official) way to change them to be inclusive:
image

Seems a bit silly to me that with so many customization options, they dont provide one to make end dates inclusive, but regardless, seems theres nothing that can be done here from primefaces side, I think I'll just end up monkey patching the javascript function to add 1 extra second or millisecond to the end date when showing them on the month view.

@newk5 newk5 closed this as completed Feb 10, 2023
@jepsar jepsar closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2023
@melloware melloware added Resolution: By Design The behavior in the issue is by design and the component exhibits the expected behavior and removed 🐞 defect Bug...Something isn't working labels Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: By Design The behavior in the issue is by design and the component exhibits the expected behavior third-party Issue is tracked in 3rd party library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants