Include the server timezone in iCal calendar export (closes #379)

This commit is contained in:
Bernd Bestel 2019-09-25 09:52:32 +02:00
parent 53f0893f55
commit 04808eaa66
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 12 additions and 3 deletions

View File

@ -5,6 +5,7 @@
- When adding a product to the shopping list from the new context/more menu from the stock overview page and if the product is already on the shopping list, the amount of that entry will be updated acccordingly instead of adding a new (double) shopping list item
- Fixed that the browser barcode scanner button was not clickable on iOS Safari (thanks @DeeeeLAN)
- Fixed a problem regarding quantity unit conversion handling for recipe ingredients of products with no unit relations, but only a different purchase/stock quantity unit
- Improved that dates in the iCal calendar export now includes the server timezone
- The API Endpoint `GET /files/{group}/{fileName}` now also returns a `Cache-Control` header (defaults fixed to 30 days) to further increase page load times
- Fixed that the API endpoint `/stock/shoppinglist/add-product` failed when a product should be added which was not already on the shopping list (thanks @Forceu)
- Some style/CSS detail-refinements

View File

@ -26,12 +26,20 @@ class CalendarApiController extends BaseApiController
$events = $this->CalendarService->GetEvents();
foreach($events as $event)
{
$date = new \DateTime($event['start']);
$date->setTimezone(date_default_timezone_get());
if ($event['date_format'] === 'date')
{
$date->setTime(23, 59, 59);
}
$vEvent = new \Eluceo\iCal\Component\Event();
$vEvent->setDtStart(new \DateTime($event['start']))
->setDtEnd(new \DateTime($event['start']))
$vEvent->setDtStart($date)
->setDtEnd($date)
->setSummary($event['title'])
->setNoTime($event['date_format'] === 'date')
->setUseUtc(false);
->setUseTimezone(true);
$vCalendar->addComponent($vEvent);
}