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

Support expressions in RRule format #25

Merged
merged 2 commits into from
Feb 21, 2023
Merged

Support expressions in RRule format #25

merged 2 commits into from
Feb 21, 2023

Conversation

yhabteab
Copy link
Member

@yhabteab yhabteab commented Jan 9, 2023

No description provided.

@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label Jan 9, 2023
@yhabteab yhabteab force-pushed the support-rrules branch 4 times, most recently from efbaf6f to dbd9a25 Compare January 10, 2023 13:29
@yhabteab yhabteab requested review from lippserd and nilmerg January 10, 2023 13:33
@yhabteab yhabteab force-pushed the support-rrules branch 2 times, most recently from 95bacbb to c14a510 Compare January 16, 2023 10:32
src/RRule.php Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
@yhabteab yhabteab added the enhancement New feature or request label Jan 17, 2023
@yhabteab yhabteab force-pushed the support-rrules branch 3 times, most recently from f591ad8 to f5c2749 Compare January 24, 2023 09:53
@yhabteab yhabteab requested a review from lippserd January 24, 2023 09:55
@yhabteab yhabteab force-pushed the support-rrules branch 3 times, most recently from 5bf80c5 to 1754206 Compare January 30, 2023 10:22
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
@yhabteab yhabteab force-pushed the support-rrules branch 2 times, most recently from e39a49e to 95b9171 Compare February 8, 2023 08:22
src/RRule.php Outdated Show resolved Hide resolved
@yhabteab yhabteab requested a review from lippserd February 15, 2023 10:19
src/RRule.php Outdated Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
Copy link
Member

@lippserd lippserd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use lower case in JSON and just use start and end without complicating things.

@yhabteab
Copy link
Member Author

It's not something I chose to do. However, if you want me to do that all by myself, I can do it. But then, I have to convert everything back to uppercase in fromJson before I pass it to the library. https://github.com/simshaun/recurr/blob/master/src/Recurr/Rule.php#L445-L592

@lippserd
Copy link
Member

It's not something I chose to do. However, if you want me to do that all by myself, I can do it. But then, I have to convert everything back to uppercase in fromJson before I pass it to the library. https://github.com/simshaun/recurr/blob/master/src/Recurr/Rule.php#L445-L592

We handle start and end on our own so I don't see why we can't just serialize the following:

  • freq (getFreqAsText()) for reconstructing the rule
  • frequency for the original frequency
  • start and end

@lippserd
Copy link
Member

lippserd commented Feb 17, 2023

Also please move fromJson() right after the constructor fromFrequency().

@yhabteab
Copy link
Member Author

We handle start and end on our own

Yes, but only for the regular frequencies which don't have INTERVAL explicit set. Everything else is passed directly to the library.

ipl-scheduler/src/RRule.php

Lines 265 to 278 in afe46d9

if (! isset($data['INTERVAL'])) {
$self = static::fromFrequency($data['FREQ']);
if (isset($data['DTSTART'])) {
$self->startAt(new DateTime($data['DTSTART']));
}
if (isset($data['DTEND'])) {
$self->endAt(new DateTime($data['DTEND']));
}
return $self;
}
return new static($data);

@lippserd
Copy link
Member

lippserd commented Feb 17, 2023

Hadn't looked closely enough at how serialization and deserialization should work. I think there is no need to do anything with microseconds since iCalendar dates only work to the second. Also, I wouldn't test serialized JSON. This is an implementation detail:

c8186ff

@yhabteab yhabteab force-pushed the support-rrules branch 2 times, most recently from 57b4c04 to 8875b83 Compare February 17, 2023 15:07
@yhabteab yhabteab requested a review from lippserd February 17, 2023 15:07
src/RRule.php Show resolved Hide resolved
src/RRule.php Outdated Show resolved Hide resolved
@nilmerg nilmerg merged commit bde2e7d into main Feb 21, 2023
@nilmerg nilmerg deleted the support-rrules branch February 21, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants