diff options
Diffstat (limited to 'vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php')
-rw-r--r-- | vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php b/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php index fccf2d600..9d311f99d 100644 --- a/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php +++ b/vendor/sabre/vobject/lib/Property/VCard/TimeStamp.php @@ -15,8 +15,8 @@ use Sabre\Xml; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class TimeStamp extends Text -{ +class TimeStamp extends Text { + /** * In case this is a multi-value property. This string will be used as a * delimiter. @@ -33,9 +33,10 @@ class TimeStamp extends Text * * @return string */ - public function getValueType() - { + function getValueType() { + return 'TIMESTAMP'; + } /** @@ -45,16 +46,16 @@ class TimeStamp extends Text * * @return array */ - public function getJsonValue() - { + function getJsonValue() { + $parts = DateTimeParser::parseVCardDateTime($this->getValue()); $dateStr = - $parts['year'].'-'. - $parts['month'].'-'. - $parts['date'].'T'. - $parts['hour'].':'. - $parts['minute'].':'. + $parts['year'] . '-' . + $parts['month'] . '-' . + $parts['date'] . 'T' . + $parts['hour'] . ':' . + $parts['minute'] . ':' . $parts['second']; // Timezone @@ -63,19 +64,23 @@ class TimeStamp extends Text } return [$dateStr]; + } /** * This method serializes only the value of a property. This is used to * create xCard or xCal documents. * - * @param Xml\Writer $writer XML writer + * @param Xml\Writer $writer XML writer. + * + * @return void */ - protected function xmlSerializeValue(Xml\Writer $writer) - { + protected function xmlSerializeValue(Xml\Writer $writer) { + // xCard is the only XML and JSON format that has the same date and time // format than vCard. $valueType = strtolower($this->getValueType()); $writer->writeElement($valueType, $this->getValue()); + } } |