Giter VIP home page Giter VIP logo

Comments (16)

tplaner avatar tplaner commented on August 20, 2024

I need to refer to the spec to see if this is working as intended or a bug, however for now you can circumvent it by doing:

$r->recur(new DateTime('2011-09-15 10:00:00'))
  ->rrule('INTERVAL=1;FREQ=MONTHLY;BYMONTHDAY=15;UNTIL=2016-09-15T10:00:00+0100');

from when.

amnuts avatar amnuts commented on August 20, 2024

I couldn't tell specifically from the RFC whether FREQ=MONTHLY was meant to work that way or not, so I took my assumption from the FREQ=YEARLY. However, doing a bit of a dig around didn't show much up until I found a unit test file from Google for their recurrence implementation:

http://google-rfc-2445.googlecode.com/svn-history/r30/trunk/test/com/google/ical/iter/RRuleIteratorImplTest.java

The relevant test being:

  public void testSimpleMonthly() throws Exception {
    runRecurrenceIteratorTest(
        "RRULE:FREQ=MONTHLY", IcalParseUtil.parseDateValue("20060120"), 5,
        "20060120,20060220,20060320,20060420,20060520,...");
  }

Which would suggest that simply using FREQ=MONTHLY would make it repeat on the same date of each month.

Thanks for the workaround, though!

from when.

wrack avatar wrack commented on August 20, 2024

Yea same here Monthly is messed up. PHP 5.4.6
btw good job so far unfortunatly it is not bug free.

from when.

tplaner avatar tplaner commented on August 20, 2024

Working on version 2 right now as we speak. I hope to correct bugs such as this in that version. Should see a beta branch this weekend.

from when.

wrack avatar wrack commented on August 20, 2024

That sounds good. I hope u can fix some bugs too.
Would u consider the code as stable with the release of version 2 ?
If i can help let me know.

from when.

darren128 avatar darren128 commented on August 20, 2024

Is this still actively being worked on? I am also experiencing the MONTHLY bug and it is stopping me from moving forward on a project. Just curious, thanks!

from when.

tplaner avatar tplaner commented on August 20, 2024

Working on version 2, this bug will not be fixed in the first version though. Version 2 should have a beta soon.

from when.

darren128 avatar darren128 commented on August 20, 2024

At the risk of being a pain, do you have any idea of a time frame for the beta release? Will beta cover at least the functionality of 1.0? Any information would be helpful, thanks!

from when.

tplaner avatar tplaner commented on August 20, 2024

I'm about 75% complete with the second version -- initial release will have the functionality of version 1 plus the addition of being able to handle byhour, byminute, and bysecond.

The way my schedule is looking right now I'm aiming for a release the beta of version 2 on Sunday May 12th.

from when.

tenfef avatar tenfef commented on August 20, 2024

I think I managed to fix this issue with the following hack:
I added this to line 136 of When.php:

If ($this->frequency == 'MONTHLY'){
    $this->bymonthday($this->start_date->format('d'));
}

And changing line 168 to call:

$this->freq($param);

Instead of

$this->frequency = $param;

It automatically sets the byMonthDay when you set the frequency to MONTHLY.

Not sure if it's a good permanent solution, but works for my purposes.

from when.

tplaner avatar tplaner commented on August 20, 2024

I'm not finished with version 2 yet, however a rough version is available on the develop branch: https://github.com/tplaner/When/tree/develop

Check out the unit tests for implementation -- it does fix this issue, however it lacks support for Rrule, bysetpos, and wkst. Rrule won't take long to implement, other two might take a little longer.

Still working on the library.

from when.

darren128 avatar darren128 commented on August 20, 2024

This is still broken for me after updating to the most recent code. FREQ=WEEKLY is also giving unexpected results. Any ideas on when this might be fixed? Or when v2 is going to be released? Thanks!

from when.

deldreth avatar deldreth commented on August 20, 2024

Some examples of the unexpected results you're getting? Part of the changes included updates to the Rrule tests and specifically include cases when only FREQ=DAILY|WEEKLY|MONTHLY|YEARLY is used.

from when.

tplaner avatar tplaner commented on August 20, 2024

@darren128, v2 is in a beta state on the develop branch. More information about it was posted in this thread: #8 (comment)

from when.

stwe avatar stwe commented on August 20, 2024

I get wrong results for:

    $r->recur(new \DateTime('2013-08-01'), 'monthly')
      ->bymonth(array(10, 11))
      ->until(new \DateTime('2013-12-31'));

results:

2013-10-01T00:00:00+02:00
2013-11-01T00:00:00+01:00
2013-10-31T00:00:00+01:00
2013-10-30T00:00:00+01:00
2013-11-30T00:00:00+01:00
2013-10-31T00:00:00+01:00
2013-10-30T00:00:00+01:00
2013-11-30T00:00:00+01:00
2013-10-31T00:00:00+01:00

the result should be:

2013-10-01T00:00:00+02:00
2013-11-01T00:00:00+01:00

from when.

tplaner avatar tplaner commented on August 20, 2024

@stwe I'd strongly suggest you start using the develop branch this works as intended with that branch (I'm not planning on fixing it for the first version):

$test = new When();
$test->startDate(new \DateTime('2013-10-01'))
     ->freq('monthly')
     ->bymonth(array(10, 11))
     ->until(new \DateTime('2013-12-31'))
     ->generateOccurences();

print_r($test->occurences);

Please note that the start date is the first date, this is according to the spec, if you left it the way you originally had it an exception would be thrown.

I'm going to be replacing the develop branch with the current version as soon as I finish the documentation, it is basically complete.

I'm closing this issue, for the future please open a new issue for bugs that you find.

from when.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.