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

getOccurrencesAfter doesn't work with microseconds #104

Closed
edalzell opened this issue Apr 11, 2022 · 4 comments
Closed

getOccurrencesAfter doesn't work with microseconds #104

edalzell opened this issue Apr 11, 2022 · 4 comments

Comments

@edalzell
Copy link

Hey there, not sure if this an actual bug.

I have found that if I set the dtstart to a time with microseconds (like 23:59:59.999999), then the nextOccurrencesAfter will return the next day's occurrence and not today's occurrence.

Once I remove the microseconds, it works fine.

I'm setting dtstart to a Carbon instance:
CleanShot 2022-04-10 at 20 50 33@2x

Where endTime() was now()->endOfDay()->toTimeString('microsecond').

@rlanvin
Copy link
Owner

rlanvin commented Apr 11, 2022

Hello, it's a bit hard to tell what's happening with the code your provided and without the exact rule, and on top of that nextOccurrencesAfter isn't part of this library, so I'm really confused.

Please provide the following:

  • Reproducible code demonstrating the bug (including the rule), so I can try myself
  • An example of expected behaviour vs actual behaviour
  • The exact version of the library your are using

Thank you!

@edalzell
Copy link
Author

edalzell commented Apr 15, 2022

With microseconds:
CleanShot 2022-04-14 at 19 21 31@2x

Without microseconds:
CleanShot 2022-04-14 at 19 21 57@2x

Notice in the first screenshot, it shows TOMORROW (today is the 14th) and the second is correct.

Version rlanvin/php-rrule v2.3.0

@edalzell edalzell changed the title Doesn't work with microseconds getOccurrencesAfer doesn't work with microseconds Apr 22, 2022
@edalzell edalzell changed the title getOccurrencesAfer doesn't work with microseconds getOccurrencesAfter doesn't work with microseconds Apr 22, 2022
@rlanvin
Copy link
Owner

rlanvin commented Apr 22, 2022

Thank you for the details. Microseconds are known to cause issues with date comparison. The microsecond component was intended to be removed from the input, but you found a bug. I published version 2.3.1 which fixes this issue.

@edalzell
Copy link
Author

Awesome, thanks for the quick fix. Love this package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants