Comments (16)
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.
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:
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.
Yea same here Monthly is messed up. PHP 5.4.6
btw good job so far unfortunatly it is not bug free.
from when.
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.
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.
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.
Working on version 2, this bug will not be fixed in the first version though. Version 2 should have a beta soon.
from when.
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.
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.
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.
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.
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.
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.
@darren128, v2 is in a beta state on the develop branch. More information about it was posted in this thread: #8 (comment)
from when.
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.
@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)
- Can't traverse year boundary using WEEKLY interval HOT 2
- Week of month support? HOT 4
- New version code HOT 6
- Every three months by first Monday starting January 7 2019 misses occurrences HOT 1
- Reference to non-existent object variable ($thisClone->limit) HOT 1
- `bysetpos` excludes the first occurence HOT 4
- Getting the next occurance or rule from NOW HOT 3
- Support for PHP 5.6 HOT 1
- FREQ=MONTHLY;UNTIL not working HOT 1
- ErrorException: implode(): Passing glue string after array is deprecated. HOT 1
- Updated Instructions ? HOT 8
- Is 0 allowed in the BYDAY rule with the day name? HOT 1
- Edge case producing results beyond UNTIL HOT 1
- Front-end design for user input HOT 6
- `$startDate` and `$endDate` could be accepted as `instanceof \DateTimeImmutable` HOT 1
- Unable to understand 'BYSETPOS' in the Docs HOT 3
- weekly every 2 or 3 or 4th week on mo, tu, we not possible? HOT 2
- Repeat dates weekly with more one day on week HOT 1
- Daily and getOccurrencesBetween HOT 4
- No error is generated if RRULE has no FREQ
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from when.