Format timestamps as UTC in ActivityStreams output. While using local times is legit per spec, it's confusing to have it change around and confuses some clients that don't handle zones right.
This commit is contained in:
parent
d2cd5b3353
commit
da7c54023d
|
@ -704,11 +704,18 @@ class Activity
|
||||||
return ActivityUtils::child($element, $tag, $namespace);
|
return ActivityUtils::child($element, $tag, $namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For consistency, we'll always output UTC rather than local time.
|
||||||
|
* Note that clients *should* accept any timezone we give them as long
|
||||||
|
* as it's properly formatted.
|
||||||
|
*
|
||||||
|
* @param int $tm Unix timestamp
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
static function iso8601Date($tm)
|
static function iso8601Date($tm)
|
||||||
{
|
{
|
||||||
$dateStr = date('d F Y H:i:s', $tm);
|
$dateStr = date('d F Y H:i:s', $tm);
|
||||||
$d = new DateTime($dateStr, new DateTimeZone('UTC'));
|
$d = new DateTime($dateStr, new DateTimeZone('UTC'));
|
||||||
$d->setTimezone(new DateTimeZone(common_timezone()));
|
|
||||||
return $d->format('c');
|
return $d->format('c');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user