mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-12-07 02:43:56 +00:00
Create a connector to synchronize with zimbra calendars
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\ZimbraBundle\Calendar\Connector\ZimbraConnector;
|
||||
|
||||
use Zimbra\Mail\Struct\DtTimeInfo;
|
||||
|
||||
/**
|
||||
* Class DateConverter.
|
||||
*
|
||||
* Provides methods for converting PHP DateTime objects
|
||||
* into specific date-time formats or representations.
|
||||
*/
|
||||
final readonly class DateConverter
|
||||
{
|
||||
public const FORMAT_DATE_TIME = 'Ymd\THis';
|
||||
|
||||
/**
|
||||
* Converts a PHP DateTimeInterface object into a Zimbra-specific DtTimeInfo object.
|
||||
*
|
||||
* @param \DateTimeInterface $date the date to be converted
|
||||
*
|
||||
* @return DtTimeInfo the converted DtTimeInfo object
|
||||
*/
|
||||
public function phpToZimbraDateTime(\DateTimeInterface $date): DtTimeInfo
|
||||
{
|
||||
return new DtTimeInfo($date->format(self::FORMAT_DATE_TIME), $date->getTimezone()->getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user