We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi ! I've got an use case who make an error inside the ArrayTranformer.
Imagine this Rule :
Rule {#11684 #timezone: "Europe/Paris" #startDate: DateTime {#9670 +"date": "2021-07-01 00:00:00.000000" +"timezone_type": 3 +"timezone": "Europe/Paris" } #endDate: DateTime {#9666 +"date": "2021-09-06 00:00:00.000000" +"timezone_type": 3 +"timezone": "Europe/Paris" } #isStartDateFromDtstart: false #freq: 3 #interval: 1 #isExplicitInterval: false #until: null #count: 1 #bySecond: null #byMinute: null #byHour: null #byDay: null #byMonthDay: null #byYearDay: null #byWeekNumber: null #byMonth: null #weekStart: "MO" #weekStartDefined: false #days: array:7 [▶] #bySetPosition: null #rDates: [] #exDates: [] }
The duration interval give us :
$start = $rule->getStartDate(); $end = $rule->getEndDate(); $durationInterval = $start->diff($end); // 2 months and 6 days ==> 67 days
the add method give us :
$end->add($durationInterval); // september 7th instead of september 6th
if we used modify instead of add :
$end->modify(sprintf("+ %s day" . ($durationInterval->days == 1 ? '' : 's'), $durationInterval->days)); // september 6th
For a full explanation : https://aiocollective.com/blog/php-datetime-difference-trap/
Is that correct for you too ? Cheer ! Vincent.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi !
I've got an use case who make an error inside the ArrayTranformer.
Imagine this Rule :
The duration interval give us :
the add method give us :
$end->add($durationInterval); // september 7th instead of september 6th
if we used modify instead of add :
$end->modify(sprintf("+ %s day" . ($durationInterval->days == 1 ? '' : 's'), $durationInterval->days)); // september 6th
For a full explanation : https://aiocollective.com/blog/php-datetime-difference-trap/
Is that correct for you too ?
Cheer !
Vincent.
The text was updated successfully, but these errors were encountered: