Skip to content

Commit

Permalink
Fix end repeat date time
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Banner authored and mattsbanner committed May 23, 2022
1 parent 6f65d16 commit 630e29b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## 1.4.1 - 23-05-22
### Fixed
- `endRepeatDate` `DateTime` object time manually set to end of day (23:59:59).

## 1.4.0 - 29-04-22
### Added
- Version number to `composer.json`.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "unionco/calendarize",
"description": "A calendar field type providing functionality for recurrence.",
"version": "1.4.0",
"version": "1.4.1",
"type": "craft-plugin",
"keywords": [
"craft",
Expand Down
10 changes: 7 additions & 3 deletions src/services/CalendarizeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ public function modifyElementsQuery(CalendarizeField $field, ElementQueryInterfa
*/
public function saveField(CalendarizeField $field, ElementInterface $owner): bool
{
/** @var Element $owner */
$locale = $owner->getSite()->language;
/** @var Map $value */
$value = $owner->getFieldValue($field->handle);

Expand Down Expand Up @@ -427,7 +425,13 @@ public function saveField(CalendarizeField $field, ElementInterface $owner): boo
$record->months = $value->months ?? null;

if (isset($value->endRepeatDate)) {
$record->endRepeatDate = Db::prepareDateForDb($value->endRepeatDate);
$endRepeat = $value->endRepeatDate;

if ($endRepeat instanceof DateTime) {
$endRepeat->setTime(23, 59, 59);
}

$record->endRepeatDate = Db::prepareDateForDb($endRepeat);
}

if (isset($value->exceptions)) {
Expand Down

0 comments on commit 630e29b

Please sign in to comment.